W3C mobileOK Basic Tests 1.0 (original) (raw)

1 Introduction

mobileOK Basic is a scheme for assessing whether Web resources (Web content) can be delivered in a manner that is conformant with Mobile Web Best Practices [Best Practices] to a simple and largely hypothetical mobile user agent, the Default Delivery Context.

This document describes W3C mobileOK Basic tests for delivered content, and describes how to emulate the DDC when requesting that content.

The intention of mobileOK is to help catalyze development of Web content that provides a functional user experience in a mobile context. It is not a test for browsers, user agents or mobile devices, and is not intended to imply anything about the way these should behave.

mobileOK does not imply endorsement or suitability of content. For example, it must not be assumed that a claim that a resource is mobileOK conformant implies that it is of higher informational value, is more reliable, more trustworthy or is more appropriate for children than any other resource.

1.1 Scope

1.1.2 Out of Scope

Some Best Practices, like TESTING, are advisable but do not meaningfully translate into concrete tests.

The tests assess whether the content can be provided in a way that achieves basic usability, efficiency, and interoperability with mobile devices. The tests should not be understood to assess thoroughly whether the content has been well-designed for mobile devices.

2 Conformance

2.4 Conduct of Tests

2.4.3 HTTP Request

The following HTTP request headers inform the server that it should deliver content that is compatible with the Default Delivery Context.

2.4.4 HTTP Response

If an HTTP request does not result in a valid HTTP response (because of network-level error, DNS resolution error, or non-HTTP response), FAIL

If the HTTP status indicates redirection (status code 3xx):

Do not carry out tests on the response

If the response relates to a request for the resource under test, or any of its Included Resources (see 2.4.7 Included Resources):

Include the size of the response in the "total size" as described under 3.16 PAGE_SIZE_LIMIT

Include this response under the count as described under3.6 EXTERNAL_RESOURCES

If there is no HTTP Location header, FAIL.

If the URI identified by the HTTPLocation header is a relative URI, create an absolute URI by combining the value of the Location header with the absolute URI of the request to which this is a response, warn

If the resulting URI is not a URI with the schemehttp or https, FAIL.

Re-request the resource using the URI formulated above.

If the HTTP status indicates that authentication is required (e.g. status code 401):

If the response relates to a request for the resource under test, or any of its Included Resources (see 2.4.7 Included Resources):

If authentication information was supplied in the HTTP request (i.e. authentication failed) or if no authentication information is available, FAIL

Carry out tests on the response

Include the size of the response in the "total size" as described under 3.16 PAGE_SIZE_LIMIT

Include this response under the count as described under3.6 EXTERNAL_RESOURCES

Re-request the resource using authentication information

If the response relates to a request for a linked resource (see 2.4.8 Linked Resources):

Continue with the test (see 3.10 LINK_TARGET_FORMAT, i.e. do not re-request the resource with authentication information), warn

If the HTTP status code is 404 or 5xx

If the response relates to a request for the resource under test, continue with tests on the response and warn

If the response relates to a request for a linked resource (see 2.4.8 Linked Resources), continue with the test (see 3.10 LINK_TARGET_FORMAT) and warn

Otherwise (i.e. for Included Resources), FAIL

If the HTTP status represents failure (4xx), other than 404, a request for authentication (e.g. 401) or a 406 when carrying out the 3.15.1 Object Element Processing Rule, FAIL

2.4.6 CSS Style

Some tests refer to "CSS Style" information. Assemble the CSS Style by using the contents of:

In the course of assembling the CSS Style use only those CSS rulesets that are not restricted as to their presentation media type or whose presentation media type list contains "handheld" or "all".

3 mobileOK Basic Tests

This section describes tests for mobileOK Basic. Tests are organized alphabetically by the Best Practice from which they derive. Where a test derives from more than one Best Practice it is placed according to the one that occurs first in dictionary order.

3.1 AUTO_REFRESH and REDIRECTION

This test does not determine whether the user is able to opt out of refresh.

If a meta element is present withhttp-equiv attribute value of "refresh",

If the URI specified as part of the contentattribute is not the current resource's URI, FAIL

Else, warn

If a Refresh HTTP header is present,

If the URI specified in the header value is not the current resource's URI, FAIL

Else, warn

3.2 CACHING

The purpose of the test is to alert providers to the fact that their content may not be cached, if it would be beneficial to do so.

Note:

Where both a meta element with http-equiv attribute and the corresponding HTTP header are found, the value of the HTTP headermust be used - see also note under 2.4.5 Meta http-equiv Elements.

If the HTTP response contains neither anExpires nor Cache-Control header

If no meta http-equiv element is present, referring to those headers, FAIL

Continue the test using the value from the meta content attribute as though it were specified in the appropriate header, warn

If a Cache-Control HTTP header is present and contains value "no-cache", or contains value "max-age=0", warn

If a Pragma HTTP header is present and contains value "no-cache", warn

If an Expires and Date HTTP header are present, and the Expires header specifies a date which is not later than what the Date header specifies, warn

If any cache related header contains an invalid value, warn

If the HTTP response contains a Last-Modifiedheader,

Request the same URI again, adding anIf-Modified-Since request header whose value matches that of the Last-Modified response header

If the HTTP response contains a Last-Modifiedheader and its value is again the same, and the HTTP response status is not 304 (Not Modified), warn

If the HTTP response contains an ETag header,

Request the same URI again, adding anIf-None-Match request header whose value matches that of theETag response header

If the HTTP response contains an ETag header and its value is again the same, and the HTTP response status is not 304 (Not Modified), warn

3.3 CHARACTER_ENCODING_SUPPORTand CHARACTER_ENCODING_USE

The DDC is defined to support only UTF-8 encoding, and hence this test fails if a resource is not encoded in UTF-8. The test does not require that resource always be encoded in UTF-8; the test merely checks that the resource is available in UTF-8 encoding, if requested. Resources may be represented using other encodings where appropriate. This test verifies that a DDC-like device which only accepts UTF-8 encoding may access the resource in UTF-8 encoding.

This test requires that character encoding is explicitly specified and recognizes the following methods of specification:

If the HTTP Content-Type header specifies a character encoding other than UTF-8, FAIL

If the HTTP Content-Type header does not specify a character encoding:

If there is no XML declaration, or UTF-8 character encoding is not specified in the XML declaration, FAIL

If the HTTP Content-Type header specifies an Internet media type starting with "text/":

If there is no meta element withhttp-equiv attribute that specifies UTF-8 character encoding, FAIL

If character encoding is specified in more than one way, and not all values are the same, FAIL

If the document is not valid UTF-8 (see 2.4.9 Validity), FAIL

For each resource specified by 2.4.7 Included Resources:

Request the resource

If the HTTP Content-Type header value of the response starts with "text/" but does not specify UTF-8 character encoding, warn

3.4 CONTENT_FORMAT_SUPPORT andVALID_MARKUP

Note:

In the following, an "html document" is a document that has "html" as its root element.

Note:

In the following, "regardless of its stated DOCTYPE" means that when assessing validity against the XHTML Basic 1.1 and XHTML MP 1.2 DTDs this may be carried out by inserting a DOCTYPE if none is present, or by replacing the given DOCTYPE with the appropriateDOCTYPE for the DTD under test.

Note:

In the following, "a known XHTML version" means XHTML Basic 1.0, XHTML Basic 1.1, XHTML-MP 1.0, XHTML-MP 1.1 or XHTML-MP 1.2.

If the document's Internet media type, as specified in the HTTP response Content-Type header, is not "application/xhtml+xml", "application/vnd.wap.xhtml+xml", or "text/html", FAIL

If the document's Internet media type is "text/html" or "application/vnd.wap.xhtml+xml", warn

If the document does not contain a DOCTYPEdeclaration, FAIL

If the document is not an HTML document, FAIL

If the DOCTYPE is not an XMLDOCTYPE, warn

If the document is an HTML document and it has an XML DOCTYPE:

If the document does not declare the html namespace on itshtml root element, FAIL

If the DOCTYPE refers to a known XHTML version, validate against thatDOCTYPE and if invalid, warn

Otherwise (if the DOCTYPE is not known), warn

If (regardless of its stated DOCTYPE) the document does not validate against the XHTML Basic 1.1 DTD:

If (regardless of its stated DOCTYPE) it does not validate against the XHTML-MP 1.2 DTD, FAIL

For each Included Resource (see 2.4.7 Included Resources):

If the response specifies an Internet media type that is not "text/css", "image/jpeg" or "image/gif", FAIL

If an image is required (see also 3.15 OBJECTS_OR_SCRIPT) and the response specifies an Internet media type that is not "image/jpeg" or "image/gif", FAIL

If the Internet media type is "image/gif" or "image/jpeg", and the resource is not valid (see 2.4.9 Validity), FAIL

If a style sheet is required and the response specifies an Internet media type that is not "text/css", FAIL

If the Internet media type is "text/css" and the content is not valid CSS (see 2.4.9 Validity), FAIL

3.5 DEFAULT_INPUT_MODE

Note:

inputmode is part of [XHTML Basic 1.1].

For each input element with attributetype whose value is "text" or "password" or whose type attribute is missing:

If the element's inputmode attribute is invalid according to Section 5.2 User Agent Behavior of XHTML Basic 1.1 [XHTML Basic 1.1], FAIL

If the element's value attribute is missing or empty, and an inputmode attribute is not present, warn

For each textarea element:

If the element's inputmode attribute is invalid according to Section 5.2 User Agent Behavior of XHTML Basic 1.1 [XHTML Basic 1.1], FAIL

If the element is empty and an inputmodeattribute is not present, warn

3.6 EXTERNAL_RESOURCES

Retrieve the resource under test, and add the number of retrievals required to obtain the resource (see 2.4.4 HTTP Response) to a running total.

For each unique Included Resource, as defined in 2.4.7 Included Resources:

Request the referenced resource

Add the number of HTTP requests that are required to retrieve the resource (see 2.4.4 HTTP Response) to the running total. Include in the count only those objects retrieved under the 3.15.1 Object Element Processing Rule whose type attribute is not specified, and those whose content type is either "image/jpeg" or "image/gif" irrespective of whether the type attribute is specified.

If the total exceeds 10, warn

If this total exceeds 20, FAIL

3.7 GRAPHICS_FOR_SPACING

The intent of this Best Practice is to avoid using transparent images for spacing. However, small transparent images are often used in e-commerce sites for user tracking purposes. The practice is common enough, and possibly vital enough to the business interests of mobile sites, that it is undesirable to fail sites that use such small transparent images. Therefore this machine-testable test merely warns about the presence of small (at most 2x2) transparent images and FAILs larger ones. It is believed that few if any sites would use transparent images of any significant size for tracking.

For each img element andobject element which is an Included Resource (see 2.4.7 Included Resources):

If all pixels are transparent,

If image height and width are both less than or equal to 2 pixels, warn

If either dimension exceeds 2 pixels, FAIL

If more than one image with all transparent pixels is present, warn

3.8 IMAGE_MAPS

If an input element with typeattribute set to "image" is present, FAIL

For each img element and object element which is an Included Resource (see 2.4.7 Included Resources):

If a usemap attribute is present, FAIL

If an ismap attribute is present, FAIL

3.9 IMAGES_RESIZING and IMAGES_SPECIFY_SIZE

Note:

The height and width HTML attributes specify pixels when they are used as a number. No unit is specified.

For each img element andobject element which is an Included Resource (see 2.4.7 Included Resources):

If the height or width attribute are missing, FAIL

If the height or width attribute do not specify a size in pixels, FAIL

If the value specified by either the height or width attribute is greater than the corresponding dimension of the image, warn

If the value specified by either the height or width attribute is less than the corresponding dimension of the image, FAIL

Note:

404 and 5xx HTTP status do not result in failure when conducting this test.

Note:

The document body of linked resources is not examined.

For each linked resource, as defined in 2.4.8 Linked Resources:

Request the resource

If the Content-Type header value of the HTTP response is not one of the Internet media types listed in theAccept header in 2.4.3 HTTP Request, warn

If the Content-Type header value of the HTTP response does not specify a charset parameter, or does but it is not consistent with the value of the Accept-Charset header in 2.4.3 HTTP Request, warn

For each document internal reference (links in the document under test that refer to the document itself):

If there is no target for the reference or it is invalid (e.g. '#'), warn

3.11 MEASURES

Note:

The intrinsic size of images must be specified as attributes of theimg element and not as CSS properties (see 3.9 IMAGES_RESIZING and IMAGES_SPECIFY_SIZE)

Note:

Only CSS Level 1 properties are considered in this test.

For each CSS Level 1 property in the CSS Style (see 2.4.6 CSS Style) whose value is a numeric measure of length stated together with a unit:

If the value is non-zero and the unit is not "em" or "ex" (and the value is not a percentage), and the property is not a margin, border or padding box property, FAIL

3.12 MINIMIZE

Note:

Extraneous white space characters in script and in CSS are not considered in this test. Such an extension may be considered in a future revision of this specification.

Count number of white space characters (see 2.4.10 White Space) in a sequence of more than one white space character (not counting the first), which exist outside of apre, style, script element, or XML comment.

Add to this count the number of characters comprising XML comments. This total is the number of extraneous characters in the document.

Count total number of characters in document.

If the number of extraneous characters exceeds 10% of the count of characters in the document, warn

If the number of extraneous characters exceeds 25% of the count of characters in the document, FAIL

3.13 NO_FRAMES

If the document contains a frame,frameset or iframe element, FAIL

3.14 NON-TEXT_ALTERNATIVES

This test does not determine whether the alternative text is meaningful.

Note:

An empty alt attribute is acceptable and signifies that there is no meaningful textual alternative, for example for images that are purely decorative.

For each img element:

If an alt attribute is not present or contains only white space, FAIL

3.15 OBJECTS_OR_SCRIPT

This test does not determine whether the document is still usable without the objects or scripts.

If a script element is present, warn

If any element has an "intrinsic event" attribute (currently onload, onunload,onclick, ondblclick, onmousedown,onmouseup, onmouseover,onmousemove, onmouseout, onfocus,onblur, onkeypress, onkeydown,onkeyup, onsubmit, onreset,onselect, onchange), warn

For each a and link element:

If the value of the href attribute begins with the "javascript:" scheme, FAIL

If an applet element is present, FAIL

Set the context to the root element and apply the Object Element Processing Rule

3.15.1 Object Element Processing Rule

Note:

A warning is issued when the Internet media type indicated by the type attribute is not compatible with the Default Delivery Context because some user agents do not take into account the type attribute of object elements and this may cause the user agent to retrieve large incompatible objects with consequences to performance and cost.

Note:

An HTTP 406 status on retrieval of a resource referenced by an object element does not constitute a FAIL.

3.16 PAGE_SIZE_LIMIT

Retrieve the document under test, if its size (excluding any redirections discussed under 2.4.4 HTTP Response) exceeds 10 kilobytes, FAIL

Add to a running total (total size) the size of all the HTTP response bodies that are required to retrieve the document under test (2.4.4 HTTP Response).

For each unique Included Resource, as defined in 2.4.7 Included Resources:

Add the size of all the response bodies that are required to retrieve the resource (see 2.4.4 HTTP Response) to the running total. Include in the total only those objects retrieved under the 3.15.1 Object Element Processing Rule whose type attribute is not specified, and those whose Internet media type as indicated by the Content-Type HTTP header is either "image/jpeg" or "image/gif" irrespective of whether the type attribute is specified.

If the total exceeds 20 kilobytes, FAIL

Note:

In the case of resources that are referenced more than once in the document under test, and where, as discussed under 2.4.7 Included Resources, they are cached, it is the initial retrieval of that resource (as determined by the first reference in document order) that counts towards the total.

Note:

Where the 3.15.1 Object Element Processing Rule yields a resource that is found to be cached, objects that must be assessed in the course of yielding the cached resource count towards the total.

3.17 PAGE_TITLE

This test does not determine whether the title is meaningful.

If a title element is not present in thehead element, or is empty, or contains only white space (see 2.4.10 White Space), FAIL

3.18 POP_UPS

For each a, link,form, and base element:

If a target attribute is present,

If its value is not one of "_self", "_parent", or "_top", FAIL

3.19 PROVIDE_DEFAULTS

For each radio button group within a formelement (input elements with type"radio" that share the same name attribute value):

Check that exactly one input element within this group has its checked attribute set to "checked", and if this is not the case, warn

For each select element:

If there is no nested option element whoseselected attribute is set to "selected",warn

If there is more than one option element whose selected attribute is set to "selected", and the multiple attribute is not set to "multiple", warn

3.21 STYLE_SHEETS_USE

This test looks for elements in the Text Extension module defined by [XHTML Modularization], some of which are not supported in XHTML Basic [XHTML Basic 1.1]. It also looks for commonly-used elements and attributes that were deprecated in HTML 4, and are not supported, or are deprecated, in XHTML Basic.

Note:

This test does not require that any CSS Style is used, since in some cases, no presentation information is required at all (for example, a simple page of text).

If the document contains any basefont,bdo, center, del,dir, font, ins, menu,s, strike or u elements, FAIL

If the document contains any b,big, i, small, sub,sup or tt elements, warn

If any element has a style attribute, warn

If all styles are restricted to presentation media types other than "handheld" or "all" by means of @mediaat-rules, warn

If the CSS Style contains at-rules (other than the@media at-rule, and the presentation media type list of the@import at-rule), properties, or values that are not recognized as being specified in CSS Level 1, or if the value of a recognized CSS Level 1 property is incompatible with the property, warn

3.23 TABLES_LAYOUT

This test does not catch all cases where tables are used for layout purposes.

For each table element:

If it contains at most one tr element, FAIL

If no tr element contains more than onetd element, FAIL

For each nested td element:

If the element contains only an image (or equivalent object) whose actual dimensions are 2x2 or less,FAIL