W3C

HTML 5.1

W3C Candidate Recommendation,

11. Obsolete features

11.1. Obsolete but conforming features

Features listed in this section will trigger warnings in conformance checkers.

Authors should not specify a border attribute on an img element. If the attribute is present, its value must be the string "0". CSS should be used instead.

Authors should not specify a language attribute on a script element. If the attribute is present, its value must be an ASCII case-insensitive match for the string "JavaScript" and either the type attribute must be omitted or its value must be an ASCII case-insensitive match for the string "text/javascript". The attribute should be entirely omitted instead (with the value "JavaScript", it has no effect), or replaced with use of the type attribute.

Authors should not specify the name attribute on a elements. If the attribute is present, its value must not be the empty string and must neither be equal to the value of any of the IDs in the element’s home subtree other than the element’s own id, if any, nor be equal to the value of any of the other name attributes on a elements in the element’s home subtree. If this attribute is present and the element has an id, then the attribute’s value must be equal to the element’s id. In earlier versions of the language, this attribute was intended as a way to specify possible targets for fragment identifiers in URLs. The id attribute should be used instead.

Authors should not, but may despite requirements to the contrary elsewhere in this specification, specify the maxlength and size attributes on input elements whose type attributes are in the Number state. One valid reason for using these attributes regardless is to help legacy user agents that do not support input elements with type="number" to still render the text field with a useful width.

In the HTML syntax, specifying a DOCTYPE that is an obsolete permitted DOCTYPE will also trigger a warning.

11.1.1. Warnings for obsolete but conforming features

To ease the transition from HTML Transitional documents to the language defined in this specification, and to discourage certain features that are only allowed in very few circumstances, conformance checkers must warn the user when the following features are used in a document. These are generally old obsolete features that have no effect, and are allowed only to distinguish between likely mistakes (regular conformance errors) and mere vestigial markup or unusual and discouraged practices (these warnings).

The following features must be categorized as described above:

Conformance checkers must distinguish between pages that have no conformance errors and have none of these obsolete features, and pages that have no conformance errors but do have some of these obsolete features.

For example, a validator could report some pages as "Valid HTML" and others as "Valid HTML with warnings".

11.2. Non-conforming features

Elements in the following list are entirely obsolete, and must not be used by authors:

applet

Use embed or object instead.

acronym

Use abbr instead.

bgsound

Use audio instead.

dir

Use ul instead.

frame

frameset

noframes

Either use iframe and CSS instead, or use server-side includes to generate complete pages with the various invariant parts merged in.

isindex

Use an explicit form and text field combination instead.

listing

Use pre and code instead.

nextid

Use GUIDs instead.

noembed

Use object instead of embed when fallback is necessary.

plaintext

Use the "text/plain" MIME type instead.

rb

rtc

Providing the ruby base directly inside the ruby element or using nested ruby elements is sufficient.

strike

Use del instead if the element is marking an edit, otherwise use s instead.

xmp

Use pre and code instead, and escape "<" and "&" characters as "&lt;" and "&amp;" respectively.

basefont

big

blink

center

font

marquee

multicol

nobr

spacer

tt

Use appropriate elements or CSS instead.

Where the tt element would have been used for marking up keyboard input, consider the kbd element; for variables, consider the var element; for computer code, consider the code element; and for computer output, consider the samp element.

Similarly, if the big element is being used to denote a heading, consider using the h1 element; if it is being used for marking up important passages, consider the strong element; and if it is being used for highlighting text for reference purposes, consider the mark element.

See also the text-level semantics usage summary for more suggestions with examples.


The following attributes are obsolete (though the elements are still part of the language), and must not be used by authors:

charset on a elements

charset on link elements

Use an HTTP Content-Type header on the linked resource instead.

coords on a elements

shape on a elements

Use area instead of a for image maps.

methods on a elements

methods on link elements

Use the HTTP OPTIONS feature instead.

name on a elements (except as noted in the previous section)

name on embed elements

name on img elements

name on option elements

Use the id attribute instead.

urn on a elements

urn on link elements

Specify the preferred persistent identifier using the href attribute instead.

accept on form elements

Use the accept attribute directly on the input elements instead.

type on area elements

These attributes do not do anything useful, and for historical reasons there are no corresponding IDL attributes on area elements. Omit them altogether.

nohref on area elements

Omitting the href attribute is sufficient; the nohref attribute is unnecessary. Omit it altogether.

profile on head elements

When used for declaring which meta terms are used in the document, unnecessary; omit it altogether, and register the names.

When used for triggering specific user agent behaviors: use a link element instead.

version on html elements

Unnecessary. Omit it altogether.

manifest on html elements

The use of application caches is not recommended. Alternative mechanisms to support offline applications include the use of [WEBSTORAGE], [IndexedDB], and [SERVICE-WORKERS].

ismap on input elements

Unnecessary. Omit it altogether. All input elements with a type attribute in the image button state are processed as server-side image maps.

usemap on input elements

Use img instead of input for image maps.

longdesc on iframe and frame elements

lowsrc on img elements

Use a progressive JPEG image (given in the src attribute), instead of using two separate images.

target on link elements

Unnecessary. Omit it altogether.

scheme on meta elements

Use only one scheme per field, or make the scheme declaration part of the value.

archive on object elements

classid on object elements

code on object elements

codebase on object elements

codetype on object elements

Use the data and type attributes to invoke plugins. To set parameters with these names in particular, the param element can be used.

declare on object elements

Repeat the object element completely each time the resource is to be reused.

standby on object elements

Optimize the linked resource so that it loads quickly or, at least, incrementally.

usemap on object elements

Use img instead of object for image maps.

type on param elements

valuetype on param elements

Use the name and value attributes without declaring value types.

language on script elements (except as noted in the previous section)

Use the type attribute instead.

event on script elements

for on script elements

Use DOM events mechanisms to register event listeners. [DOM]

media on source elements

Use script to select the media resource(s) to use.

datapagesize on table elements

Unnecessary. Omit it altogether.

summary on table elements

Use one of the §4.9.1.1 Techniques for describing tables given in the table section instead.

abbr on td elements

Use text that begins in an unambiguous and terse manner, and include any more elaborate text after that. The title attribute can also be useful in including more detailed text, so that the cell’s contents can be made terse. If it’s a heading, use th (which has an abbr attribute).

axis on td and th elements

Use the scope attribute on the relevant th.

scope on td elements

Use th elements for heading cells.

datasrc on a, applet, button, div, frame, iframe, img, input, label, legend, marquee, object, option, select, span, table, and textarea elements

datafld on a, applet, button, div, fieldset, frame, iframe, img, input, label, legend, marquee, object, param, select, span, and textarea elements

dataformatas on button, div, input, label, legend, marquee, object, option, select, span, and table elements

Use script and a mechanism such as XMLHttpRequest to populate the page dynamically. [XHR]

alink on body elements

bgcolor on body elements

bottommargin on body elements

leftmargin on body elements

link on body elements

marginheight on body elements

marginwidth on body elements

rightmargin on body elements

text on body elements

margintop on body elements

vlink on body elements

clear on br elements

align on caption elements

align on col elements

char on col elements

charoff on col elements

valign on col elements

width on col elements

align on div elements

compact on dl elements

align on embed elements

hspace on embed elements

vspace on embed elements

align on hr elements

color on hr elements

noshade on hr elements

size on hr elements

width on hr elements

align on h1h6 elements

align on iframe elements

allowtransparency on iframe elements

frameborder on iframe elements

framespacing on iframe elements

hspace on iframe elements

marginheight on iframe elements

marginwidth on iframe elements

scrolling on iframe elements

vspace on iframe elements

align on input elements

border on input elements

hspace on input elements

vspace on input elements

align on img elements

border on img elements (except as noted in the previous section)

hspace on img elements

vspace on img elements

align on legend elements

type on li elements

compact on menu elements

align on object elements

border on object elements

hspace on object elements

vspace on object elements

compact on ol elements

align on p elements

width on pre elements

align on table elements

bgcolor on table elements

border on table elements

bordercolor on table elements

cellpadding on table elements

cellspacing on table elements

frame on table elements

height on table elements

rules on table elements

width on table elements

align on tbody, thead, and tfoot elements

char on tbody, thead, and tfoot elements

charoff on tbody, thead, and tfoot elements

valign on tbody, thead, and tfoot elements

align on td and th elements

bgcolor on td and th elements

char on td and th elements

charoff on td and th elements

height on td and th elements

nowrap on td and th elements

valign on td and th elements

width on td and th elements

align on tr elements

bgcolor on tr elements

char on tr elements

charoff on tr elements

height on tr elements

valign on tr elements

compact on ul elements

type on ul elements

background on body, table, thead, tbody, tfoot, tr, td, and th elements

Use CSS instead.


The border attribute on the table element can be used to provide basic fallback styling for the purpose of making tables legible in browsing environments where CSS support is limited or absent, such as text-based browsers, WYSIWYG editors, and in situations where CSS support is disabled or the style sheet is lost. Only the empty string and the value "1" may be used as border values for this purpose. Other values are considered obsolete. To regulate the thickness of such borders, authors should instead use CSS.

11.3. Requirements for implementations

11.3.1. The applet element

This feature is in the process of being removed from the Web platform. (This is a long process that takes many years.) Using the applet element at this time is highly discouraged.

The applet element is a Java-specific variant of the embed element. The applet element is now obsoleted so that all extension frameworks (Java, .NET, Flash, etc) are handled in a consistent manner.

When the element matches any of the following conditions, it represents its contents:

Otherwise, the user agent should instantiate a Java Language runtime plugin, and should pass the names and values of all the attributes on the element, in the order they were added to the element, with the attributes added by the parser being ordered in source order, and then a parameter named "PARAM" whose value is null, and then all the names and values of parameters given by param elements that are children of the applet element, in tree order, to the plugin used. If the plugin supports a scriptable interface, the HTMLAppletElement object representing the element should expose that interface. The applet element represents the plugin.

The applet element is unaffected by the CSS display property. The Java Language runtime is instantiated even if the element is hidden with a 'display:none' CSS style.

The applet element must implement the HTMLAppletElement interface.

interface HTMLAppletElement : HTMLElement {
  attribute DOMString align;
  attribute DOMString alt;
  attribute DOMString archive;
  attribute DOMString code;
  attribute DOMString codeBase;
  attribute DOMString height;
  attribute unsigned long hspace;
  attribute DOMString name;
  attribute DOMString _object; // the underscore is not part of the identifier
  attribute unsigned long vspace;
  attribute DOMString width;
};

The align, alt, archive, code, height, hspace, name, object, vspace, and width IDL attributes must reflect the respective content attributes of the same name. For the purposes of reflection, the applet element’s object content attribute is defined as containing a URL.

The codeBase IDL attribute must reflect the codebase content attribute, which for the purposes of reflection is defined as containing a URL.

11.3.2. The marquee element

The marquee element is a presentational element that animates content. CSS transitions and animations are a more appropriate mechanism. [CSS3-ANIMATIONS] [CSS3-TRANSITIONS]

The task source for tasks mentioned in this section is the DOM manipulation task source.

The marquee element must implement the HTMLMarqueeElement interface.

interface HTMLMarqueeElement : HTMLElement {
  attribute DOMString behavior;
  attribute DOMString bgColor;
  attribute DOMString direction;
  attribute DOMString height;
  attribute unsigned long hspace;
  attribute long loop;
  attribute unsigned long scrollAmount;
  attribute unsigned long scrollDelay;
  attribute boolean trueSpeed;
  attribute unsigned long vspace;
  attribute DOMString width;

  attribute EventHandler onbounce;
  attribute EventHandler onfinish;
  attribute EventHandler onstart;

  void start();
  void stop();
};

A marquee element can be turned on or turned off. When it is created, it is turned on.

When the start() method is called, the marquee element must be turned on.

When the stop() method is called, the marquee element must be turned off.

When a marquee element is created, the user agent must queue a task to fire a simple event named start at the element.


The behavior content attribute on marquee elements is an enumerated attribute with the following keywords (all non-conforming):

Keyword State
scroll scroll
slide slide
alternate alternate

The missing value default is the scroll state.


The direction content attribute on marquee elements is an enumerated attribute with the following keywords (all non-conforming):

Keyword State
left left
right right
up up
down down

The missing value default is the left state.


The truespeed content attribute on marquee elements is a boolean attribute.


A marquee element has a marquee scroll interval, which is obtained as follows:

  1. If the element has a scrolldelay content attribute, and parsing its value using the rules for parsing non-negative integers does not return an error, then let delay be the parsed value. Otherwise, let delay be 85.

  2. If the element does not have a truespeed attribute, and the delay value is less than 60, then let delay be 60 instead.

  3. The marquee scroll interval is delay, interpreted in milliseconds.


A marquee element has a marquee scroll distance, which, if the element has a scrollamount content attribute, and parsing its value using the rules for parsing non-negative integers does not return an error, is the parsed value interpreted in CSS pixels, and otherwise is 6 CSS pixels.


A marquee element has a marquee loop count, which, if the element has a loop content attribute, and parsing its value using the rules for parsing integers does not return an error or a number less than 1, is the parsed value, and otherwise is -1.

The loop IDL attribute, on getting, must return the element’s marquee loop count; and on setting, if the new value is different than the element’s marquee loop count and either greater than zero or equal to -1, must set the element’s loop content attribute (adding it if necessary) to the valid integer that represents the new value. (Other values are ignored.)

A marquee element also has a marquee current loop index, which is zero when the element is created.

The rendering layer will occasionally increment the marquee current loop index, which must cause the following steps to be run:

  1. If the marquee loop count is -1, then abort these steps.

  2. Increment the marquee current loop index by one.

  3. If the marquee current loop index is now equal to or greater than the element’s marquee loop count, turn off the marquee element and queue a task to fire a simple event named finish at the marquee element.

    Otherwise, if the behavior attribute is in the alternate state, then queue a task to fire a simple event named bounce at the marquee element.

    Otherwise, queue a task to fire a simple event named start at the marquee element.


The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler content attributes and event handler IDL attributes, by marquee elements:

Event handler Event handler event type
onbounce bounce
onfinish finish
onstart start

The behavior, direction, height, hspace, vspace, and width IDL attributes must reflect the respective content attributes of the same name.

The bgColor IDL attribute must reflect the bgcolor content attribute.

The scrollAmount IDL attribute must reflect the scrollamount content attribute. The default value is 6.

The scrollDelay IDL attribute must reflect the scrolldelay content attribute. The default value is 85.

The trueSpeed IDL attribute must reflect the truespeed content attribute.

11.3.3. Frames

The frameset element acts as the body element in documents that use frames.

The frameset element must implement the HTMLFrameSetElement interface.

interface HTMLFrameSetElement : HTMLElement {
  attribute DOMString cols;
  attribute DOMString rows;
};
HTMLFrameSetElement implements WindowEventHandlers;

The cols and rows IDL attributes of the frameset element must reflect the respective content attributes of the same name.

The frameset element exposes as event handler content attributes a number of the event handlers of the Window object. It also mirrors their event handler IDL attributes.

The onblur, onerror, onfocus, onload, onresize, and onscroll event handlers of the Window object, exposed on the frameset element, replace the generic event handlers with the same names normally supported by html elements.


The frame element defines a nested browsing context similar to the iframe element, but rendered within a frameset element.

A frame element is said to be an active frame element when it is in a Document.

When a frame element is created as an active frame element, or becomes an active frame element after not having been one, the user agent must create a nested browsing context, and then process the frame attributes for the first time.

When a frame element stops being an active frame element, the user agent must discard the nested browsing context.

Whenever a frame element with a nested browsing context has its src attribute set, changed, or removed, the user agent must process the frame attributes.

When the user agent is to process the frame attributes, it must run the first appropriate steps from the following list:

If the element has no src attribute specified, and the user agent is processing the frame's attributes for the first time
Queue a task to fire a simple event named load at the frame element.
Otherwise
  1. If the value of the src attribute is the empty string, let url be the string "about:blank".

    Otherwise, resolve the value of the src attribute, relative to the frame element.

    If that is not successful, then let url be the string "about:blank". Otherwise, let url be the resulting absolute URL.

  2. Navigate the element’s child browsing contextto url.

Furthermore, if the active document of the element’s child browsing context before such a navigation was not completely loaded at the time of the new navigation, then the navigation must be completed with replacement enabled.

Similarly, if the child browsing context’s session history contained only one Document when the process the frame attributes algorithm was invoked, and that was the about:blank Document created when the child browsing context was created, then any navigation required of the user agent in that algorithm must be completed with replacement enabled.

When a Document in a frame is marked as completely loaded, the user agent must queue a task to fire a simple event named load at the frame element.

The task source for the tasks above is the DOM manipulation task source.

When a frame element’s nested browsing context’s active document is not ready for post-load tasks, and when anything is delaying the load event of the frame element’s browsing context’s active document, and when the frame element’s browsing context is in the delaying load events mode, the frame must delay the load event of its document.

When the browsing context is created, if a name content attribute is present, the browsing context name must be set to the value of this attribute; otherwise, the browsing context name must be set to the empty string.

Whenever the name attribute is set, the nested browsing context’s name must be changed to the new value. If the attribute is removed, the browsing context name must be set to the empty string.

The frame element must implement the HTMLFrameElement interface.

interface HTMLFrameElement : HTMLElement {
  attribute DOMString name;
  attribute DOMString scrolling;
  attribute DOMString src;
  attribute DOMString frameBorder;
  attribute DOMString longDesc;
  attribute boolean noResize;
  readonly attribute Document? contentDocument;
  readonly attribute WindowProxy? contentWindow;

  [TreatNullAs=EmptyString] attribute DOMString marginHeight;
  [TreatNullAs=EmptyString] attribute DOMString marginWidth;
};

The name, scrolling, and src IDL attributes of the frame element must reflect the respective content attributes of the same name. For the purposes of reflection, the frame element’s src content attribute is defined as containing a URL.

The frameBorder IDL attribute of the frame element must reflect the element’s frameborder content attribute.

The longDesc IDL attribute of the frame element must reflect the element’s longdesc content attribute, which for the purposes of reflection is defined as containing a URL.

The noResize IDL attribute of the frame element must reflect the element’s noresize content attribute.

The contentDocument IDL attribute of the frame element must return the Document object of the active document of the frame element’s nested browsing context, if any and if its origin is the same origin-domain as the origin specified by the incumbent settings object, or null otherwise.

The contentWindow IDL attribute must return the WindowProxy object of the frame element’s nested browsing context.

The marginHeight IDL attribute of the frame element must reflect the element’s marginheight content attribute.

The marginWidth IDL attribute of the frame element must reflect the element’s marginwidth content attribute.

11.3.4. Application caches

An application cache is a set of cached resources consisting of:

Each application cache has a completeness flag, which is either complete or incomplete.


An application cache group is a group of application caches, identified by the absolute URL of a resource manifest which is used to populate the caches in the group.

An application cache is newer than another if it was created after the other (in other words, application caches in an application cache group have a chronological order).

Only the newest application cache in an application cache group can have its completeness flag set to incomplete; the others are always all complete.

Each application cache group has an update status, which is one of the following: idle, checking, downloading.

A relevant application cache is an application cache that is the newest in its group to be complete.

Each application cache group has a list of pending master entries. Each entry in this list consists of a resource and a corresponding Document object. It is used during the application cache download process to ensure that new master entries are cached even if the application cache download process was already running for their application cache group when they were loaded.

An application cache group can be marked as obsolete, meaning that it must be ignored when looking at what application cache groups exist.


A cache host is a Document or a SharedWorkerGlobalScope object. A cache host can be associated with an application cache.

[WEBWORKERS]

A Document initially is not associated with an application cache, but can become associated with one early during the page load process, when steps in the parser and in the navigation sections cause cache selection to occur.

A SharedWorkerGlobalScope can be associated with an application cache when it is created.

[WEBWORKERS]

Each cache host has an associated ApplicationCache object.


Multiple application caches in different application cache groups can contain the same resource, e.g., if the manifests all reference that resource. If the user agent is to select an application cache from a list of relevant application caches that contain a resource, the user agent must use the application cache that the user most likely wants to see the resource from, taking into account the following:


A URL matches a fallback namespace if there exists a relevant application cache whose manifest’s URL has the same origin as the URL in question, and that has a fallback namespace that is a prefix match for the URL being examined. If multiple fallback namespaces match the same URL, the longest one is the one that matches. A URL looking for a fallback namespace can match more than one application cache at a time, but only matches one namespace in each cache.

11.3.4.1. Parsing cache manifests

When a user agent is to parse a manifest, it means that the user agent must run the following steps:

  1. UTF-8 decode the byte stream corresponding with the manifest to be parsed.

    The UTF-8 decode algorithm strips a leading BOM, if any.

  2. Let base URL be the absolute URL representing the manifest.
  3. Apply the URL parser to base URL, and let manifest path be the path component thus obtained.
  4. Remove all the characters in manifest path after the last U+002F SOLIDUS character (/), if any. (The first character and the last character in manifest path after this step will both be slashes, the URL path separator character.)
  5. Apply the URL parser steps to the base URL, so that the components from its URL record can be used by the subsequent steps of this algorithm.
  6. Let explicit URLs be an initially empty list of absolute URLs for explicit entries.
  7. Let fallback URLs be an initially empty mapping of fallback namespaces to absolute URLs for fallback entries.
  8. Let online safelist namespaces be an initially empty list of absolute URLs for an online safelist.
  9. Let online safelist wildcard flag be blocking.
  10. Let cache mode flag be fast.
  11. Let input be the decoded text of the manifest’s byte stream.
  12. Let position be a pointer into input, initially pointing at the first character.
  13. If the characters starting from position are "CACHE", followed by a U+0020 SPACE character, followed by "MANIFEST", then advance position to the next character after those. Otherwise, this isn’t a cache manifest; abort this algorithm with a failure while checking for the magic signature.
  14. If the character at position is neither a U+0020 SPACE character, a U+0009 CHARACTER TABULATION (tab) character, U+000A LINE FEED (LF) character, nor a U+000D CARRIAGE RETURN (CR) character, then this isn’t a cache manifest; abort this algorithm with a failure while checking for the magic signature.
  15. This is a cache manifest. The algorithm cannot fail beyond this point (though bogus lines can get ignored).
  16. Collect a sequence of characters that are not U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters, and ignore those characters. (Extra text on the first line, after the signature, is ignored.)
  17. Let mode be "explicit".
  18. Start of line: If position is past the end of input, then jump to the last step. Otherwise, collect a sequence of characters that are U+000A LINE FEED (LF), U+000D CARRIAGE RETURN (CR), U+0020 SPACE, or U+0009 CHARACTER TABULATION (tab) characters.
  19. Now, collect a sequence of characters that are not U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters, and let the result be line.
  20. Drop any trailing U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters at the end of line.
  21. If line is the empty string, then jump back to the step labeled start of line.
  22. If the first character in line is a U+0023 NUMBER SIGN character (#), then jump back to the step labeled Start of line.
  23. If line equals "CACHE:" (the word "CACHE" followed by a U+003A COLON character (:)), then set mode to "explicit" and jump back to the step labeled Start of line.
  24. If line equals "FALLBACK:" (the word "FALLBACK" followed by a U+003A COLON character (:)), then set mode to "fallback" and jump back to the step labeled Start of line.
  25. If line equals "NETWORK:" (the word "NETWORK" followed by a U+003A COLON character (:)), then set mode to "online safelist" and jump back to the step labeled Start of line.
  26. If line equals "SETTINGS:" (the word "SETTINGS" followed by a U+003A COLON character (:)), then set mode to "settings" and jump back to the step labeled Start of line.
  27. If line ends with a U+003A COLON character (:), then set mode to "unknown" and jump back to the step labeled Start of line.
  28. This is either a data line or it is syntactically incorrect.
  29. Let position be a pointer into line, initially pointing at the start of the string.
  30. Let tokens be a list of strings, initially empty.
  31. While position doesn’t point past the end of line:

    1. Let current token be an empty string.
    2. While position doesn’t point past the end of line and the character at position is neither a U+0020 SPACE nor a U+0009 CHARACTER TABULATION (tab) character, add the character at position to current token and advance position to the next character in input.
    3. Add current token to the tokens list.
    4. While position doesn’t point past the end of line and the character at position is either a U+0020 SPACE or a U+0009 CHARACTER TABULATION (tab) character, advance position to the next character in input.
  32. Process tokens as follows:

    If mode is "explicit"

    Let urlRecord be the result of parsing the first item in tokens, with base URL; ignore the rest.

    If urlRecord is failure, then jump back to the step labeled Start of line.

    If urlRecord has a different scheme component than base URL (the manifest’s URL), then jump back to the step labeled Start of line.

    Let new URL be the result of applying the URL serializer algorithm to urlRecord, with the exclude fragment flag set.

    Add new URL to the explicit URLs.

    If mode is "fallback"
    Let part one be the first token in tokens, and let part two be the second token in tokens.

    Let urlRecordOne be the result of parsing part one with base URL.

    Let urlRecordTwo be the result of parsing part two with base URL.

    If either urlRecordOne or urlRecordTwo is failure, then jump back to the step labeled Start of line.

    If the origin of either urlRecordOne or urlRecordTwo is not same origin with the manifest’s URL origin, then jump back to the step labeled Start of line.

    Let part one path be the path component of urlRecordOne.

    If manifest path is not a prefix match for part one path, then jump back to the step labeled Start of line.

    Let part one be the result of applying the URL serializer algorithm to urlRecordOne, with the exclude fragment flag set.

    Let part two be the result of applying the URL serializer algorithm to urlRecordTwo, with the exclude fragment flag set.

    If part one is already in the fallback URLs mapping as a fallback namespace, then jump back to the step labeled Start of line.

    Otherwise, add part one to the fallback URLs mapping as a fallback namespace, mapped to part two as the fallback entry.

    If mode is "online safelist"

    If the first item in tokens is a U+002A ASTERISK character (*), then set online safelist wildcard flag to open and jump back to the step labeled Start of line.

    Otherwise, let urlRecord be the result of parsing the first item in tokens with base URL.

    If urlRecord is failure, then jump back to the step labeled Start of line.

    If urlRecord has a different scheme component than base URL (the manifest’s URL), then jump back to the step labeled Start of line.

    Let new URL be the result of applying the URL serializer algorithm to urlRecord, with the exclude fragment flag set.

    Add new URL to the online safelist namespaces.

    If mode is "settings"

    If tokens contains a single token, and that token is a case-sensitive match for the string "prefer-online", then set cache mode flag to prefer-online and jump back to the step labeled Start of line.

    Otherwise, the line is an unsupported setting: do nothing; the line is ignored.

    If mode is "unknown"

    Do nothing. The line is ignored.

  33. Jump back to the step labeled Start of line. (That step jumps to the next, and last, step when the end of the file is reached.)
  34. Return the explicit URLs list, the fallback URLs mapping, the online safelist namespaces, the online safelist wildcard flag, and the cache mode flag.
11.3.4.2. Downloading or updating an application cache

When the user agent is required (by other parts of this specification) to start the application cache download process for an absolute URL purported to identify a manifest, or for an application cache group, potentially given a particular cache host, and potentially given a master resource, the user agent must run the steps below. These steps are always run in parallel with the event loop tasks.

Some of these steps have requirements that only apply if the user agent shows caching progress. Support for this is optional. Certain events fired during the application cache download process allow the script to override the display of such an interface. (Such events are delayed until after the load event has fired.)

User agents are encouraged not to show prominent update progress notifications for applications that cancel the relevant events.

The application cache download process steps are as follows:

  1. Optionally, wait until the permission to start the application cache download process has been obtained from the user and until the user agent is confident that the network is available. This could include doing nothing until the user explicitly opts-in to caching the site, or could involve prompting the user for permission. The algorithm might never get past this point. (This step is particularly intended to be used by user agents running on severely space-constrained devices or in highly privacy-sensitive environments).
  2. Atomically, so as to avoid race conditions, perform the following substeps:

    1. Pick the appropriate substeps:

      If these steps were invoked with an absolute URL purported to identify a manifest

      Let manifest URL be that absolute URL.

      If there is no application cache group identified by manifest URL, then create a new application cache group identified by manifest URL. Initially, it has no application caches. One will be created later in this algorithm.

      If these steps were invoked with an application cache group

      Let manifest URL be the absolute URL of the manifest used to identify the application cache group to be updated.

      If that application cache group is obsolete, then abort this instance of the application cache download process. This can happen if another instance of this algorithm found the manifest to be 404 or 410 while this algorithm was waiting in the first step above.

    2. Let cache group be the application cache group identified by manifest URL.
    3. If these steps were invoked with a master resource, then add the resource, along with the resource’s Document, to cache group’s list of pending master entries.
    4. If these steps were invoked with a cache host, and the status of cache group is checking or downloading, then queue a post-load task to fire a simple event named checking that is cancelable at the ApplicationCache singleton of that cache host. The default action of this event must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that the user agent is checking to see if it can download the application.
    5. If these steps were invoked with a cache host, and the status of cache group is downloading, then also queue a post-load task to fire a simple event named downloading that is cancelable at the ApplicationCache singleton of that cache host. The default action of this event must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user the application is being downloaded.
    6. If the status of the cache group is either checking or downloading, then abort this instance of the application cache download process, as an update is already in progress.
    7. Set the status of cache group to checking.
    8. For each cache host associated with an application cache in cache group, queue a post-load task to fire a simple event that is cancelable named checking at the ApplicationCache singleton of the cache host. The default action of these events must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that the user agent is checking for the availability of updates.

    The remainder of the steps run in parallel.

    If cache group already has an application cache in it, then this is an upgrade attempt. Otherwise, this is a cache attempt.

  3. If this is a cache attempt, then this algorithm was invoked with a cache host; queue a post-load task to fire a simple event named checking that is cancelable at the ApplicationCache singleton of that cache host. The default action of this event must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that the user agent is checking for the availability of updates.
  4. Let request be a new request whose URL is manifest URL, client is null, destination is "subresource", omit-Origin-header flag is set, referrer is "no-referrer", synchronous flag is set, credentials mode is "include", and whose use-URL-credentials flag is set.
  5. Fetching the manifest: Let manifest be the result of fetching request. HTTP caching semantics should be honored for this request.

    Parse manifest’s body according to the rules for parsing manifests, obtaining a list of explicit entries, fallback entries and the fallback namespaces that map to them, entries for the online safelist, and values for the online safelist wildcard flag and the cache mode flag.

    The MIME type of the resource is ignored — it is assumed to be text/cache-manifest. In the future, if new manifest formats are supported, the different types will probably be distinguished on the basis of the file signatures (for the current format, that is the "CACHE MANIFEST" string at the top of the file).

  6. If fetching the manifest fails due to a 404 or 410 response status, then run these substeps:

    1. Mark cache group as obsolete. This cache group no longer exists for any purpose other than the processing of Document objects already associated with an application cache in the cache group.
    2. Let task list be an empty list of tasks.
    3. For each cache host associated with an application cache in cache group, create a task to fire a simple event named obsolete that is cancelable at the ApplicationCache singleton of the cache host, and append it to task list. The default action of these events must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that the application is no longer available for offline use.
    4. For each entry in cache group’s list of pending master entries, create a task to fire a simple event that is cancelable named error (not obsolete!) at the ApplicationCache singleton of the Document for this entry, if there still is one, and append it to task list. The default action of this event must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that the user agent failed to save the application for offline use.
    5. If cache group has an application cache whose completeness flag is incomplete, then discard that application cache.
    6. If appropriate, remove any user interface indicating that an update for this cache is in progress.
    7. Let the status of cache group be idle.
    8. For each task in task list, queue that task as a post-load task.
    9. Abort the application cache download process.
  7. Otherwise, if fetching the manifest fails in some other way (e.g., the server returns another 4xx or 5xx response, or there is a DNS error, or the connection times out, or the user cancels the download, or the parser for manifests fails when checking the magic signature), or if the server returned a redirect, then run the cache failure steps. [HTTP]

  8. If this is an upgrade attempt and the newly downloaded manifest is byte-for-byte identical to the manifest found in the newest application cache in cache group, or the response status is 304, then run these substeps:

    1. Let cache be the newest application cache in cache group.
    2. Let task list be an empty list of tasks.
    3. For each entry in cache group’s list of pending master entries, wait for the resource for this entry to have either completely downloaded or failed.

      If the download failed (e.g., the server returns a 4xx or 5xx response, or there is a DNS error, the connection times out, or the user cancels the download), or if the resource is labeled with the "no-store" cache directive, then create a task to fire a simple event that is cancelable named error at the ApplicationCache singleton of the Document for this entry, if there still is one, and append it to task list. The default action of this event must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that the user agent failed to save the application for offline use.

      Otherwise, associate the Document for this entry with cache; store the resource for this entry in cache, if it isn’t already there, and categorize its entry as a master entry. If applying the URL parser algorithm to the resource’s URL results in a resulting URL record that has a non-null fragment component, the URL used for the entry in cache must instead be the absolute URL obtained from applying the URL serializer algorithm to the resulting URL record with the exclude fragment flag set (application caches never include fragment identifiers).

    4. For each cache host associated with an application cache in cache group, create a task to fire a simple event that is cancelable named noupdate at the ApplicationCache singleton of the cache host, and append it to task list. The default action of these events must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that the application is up to date.
    5. Empty cache group’s list of pending master entries.
    6. If appropriate, remove any user interface indicating that an update for this cache is in progress.
    7. Let the status of cache group be idle.
    8. For each task in task list, queue that task as a post-load task.
    9. Abort the application cache download process.
  9. Let new cache be a newly created application cache in cache group. Set its completeness flag to incomplete.
  10. For each entry in cache group’s list of pending master entries, associate the Document for this entry with new cache.
  11. Set the status of cache group to downloading.
  12. For each cache host associated with an application cache in cache group, queue a post-load task to fire a simple event that is cancelable named downloading at the ApplicationCache singleton of the cache host. The default action of these events must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that a new version is being downloaded.
  13. Let file list be an empty list of URLs with flags.
  14. Add all the URLs in the list of explicit entries obtained by parsing manifest to file list, each flagged with "explicit entry".
  15. Add all the URLs in the list of fallback entries obtained by parsing manifest to file list, each flagged with "fallback entry".
  16. If this is an upgrade attempt, then add all the URLs of master entries in the newest application cache in cache group whose completeness flag is complete to file list, each flagged with "master entry".
  17. If any URL is in file list more than once, then merge the entries into one entry for that URL, that entry having all the flags that the original entries had.
  18. For each URL in file list, run the following steps. These steps may be run in parallel for two or more of the URLs at a time. If, while running these steps, the ApplicationCache object’s abort() method sends a signal to this instance of the application cache download process algorithm, then run the cache failure steps instead.

    1. If the resource URL being processed was flagged as neither an "explicit entry" nor or a "fallback entry", then the user agent may skip this URL.

      This is intended to allow user agents to expire resources not listed in the manifest from the cache. Generally, implementors are urged to use an approach that expires lesser-used resources first.

    2. For each cache host associated with an application cache in cache group, queue a progress post-load task to fire a trusted event with the name progress, which does not bubble, which is cancelable, and which uses the ProgressEvent interface, at the ApplicationCache singleton of the cache host. The lengthComputable attribute must be set to true, the total attribute must be set to the number of files in file list, and the loaded attribute must be set to the number of files in file list that have been either downloaded or skipped so far. The default action of these events must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that a file is being downloaded in preparation for updating the application. [XHR]
    3. Let request be a new request whose URL is URL, client is null, destination is "subresource", origin is manifest URL’s origin, referrer is "no-referrer", synchronous flag is set, credentials mode is "include", use-URL-credentials flag is set, and redirect mode is "manual".
    4. Fetch request. If this is an upgrade attempt, then use the newest application cache in cache group as an HTTP cache, and honor HTTP caching semantics (such as expiration, ETags, and so forth) with respect to that cache. User agents may also have other caches in place that are also honored.
    5. If the previous step fails (e.g., the server returns a 4xx or 5xx response, or there is a DNS error, or the connection times out, or the user cancels the download), or if the server returned a redirect, or if the resource is labeled with the "no-store" cache directive, then run the first appropriate step from the following list: [HTTP]

      If the URL being processed was flagged as an "explicit entry" or a "fallback entry"

      If these steps are being run in parallel for any other URLs in file list, then abort these steps for those other URLs. Run the cache failure steps.

      Redirects are fatal because they are either indicative of a network problem (e.g., a captive portal); or would allow resources to be added to the cache under URLs that differ from any URL that the networking model will allow access to, leaving orphan entries; or would allow resources to be stored under URLs different than their true URLs. All of these situations are bad.

      If the error was a 404 or 410 HTTP response
      If the resource was labeled with the "no-store" cache directive

      Skip this resource. It is dropped from the cache.

      Otherwise

      Copy the resource and its metadata from the newest application cache in cache group whose completeness flag is complete, and act as if that was the fetched resource, ignoring the resource obtained from the network.

      These rules make errors for resources listed in the manifest fatal, while making it possible for other resources to be removed from caches when they are removed from the server, without errors, and making non-manifest resources survive server-side errors.

      Except for the "no-store" directive, HTTP caching rules that would cause a file to be expired or otherwise not cached are ignored for the purposes of the application cache download process.

    6. Otherwise, the fetching succeeded. Store the resource in the new cache.

      If the user agent is not able to store the resource (e.g., because of quota restrictions), the user agent may prompt the user or try to resolve the problem in some other manner (e.g., automatically pruning content in other caches). If the problem cannot be resolved, the user agent must run the cache failure steps.

    7. If the URL being processed was flagged as an "explicit entry" in file list, then categorize the entry as an explicit entry.
    8. If the URL being processed was flagged as a "fallback entry" in file list, then categorize the entry as a fallback entry.
    9. If the URL being processed was flagged as an "master entry" in file list, then categorize the entry as a master entry.
    10. As an optimization, if the resource is an HTML or XML file whose root element is an html element with a manifest attribute whose value doesn’t match the manifest URL of the application cache being processed, then the user agent should mark the entry as being foreign.
  19. For each cache host associated with an application cache in cache group, queue a progress post-load task to fire a trusted event with the name progress, which does not bubble, which is cancelable, and which uses the ProgressEvent interface, at the ApplicationCache singleton of the cache host. The lengthComputable attribute must be set to true, the total and the loaded attributes must be set to the number of files in file list. The default action of these events must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that all the files have been downloaded. [XHR]
  20. Store the list of fallback namespaces, and the URLs of the fallback entries that they map to, in new cache.
  21. Store the URLs that form the new online safelist in new cache.
  22. Store the value of the new online safelist wildcard flag in new cache.
  23. Store the value of the new cache mode flag in new cache.
  24. For each entry in cache group’s list of pending master entries, wait for the resource for this entry to have either completely downloaded or failed.

    If the download failed (e.g., the server returns a 4xx or 5xx response, or there is a DNS error, the connection times out, or the user cancels the download), or if the resource is labeled with the "no-store" cache directive, then run these substeps:

    1. Unassociate the Document for this entry from new cache.
    2. Queue a post-load task to fire a simple event that is cancelable named error at the ApplicationCache singleton of the Document for this entry, if there still is one. The default action of this event must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that the user agent failed to save the application for offline use.
    3. If this is a cache attempt and this entry is the last entry in cache group’s list of pending master entries, then run these further substeps:

      1. Discard cache group and its only application cache, new cache.
      2. If appropriate, remove any user interface indicating that an update for this cache is in progress.
      3. Abort the application cache download process.
    4. Otherwise, remove this entry from cache group’s list of pending master entries.

    Otherwise, store the resource for this entry in new cache, if it isn’t already there, and categorize its entry as a master entry.

  25. Let request be a new request whose URL is manifest URL, client is null, destination is "subresource", referrer is "no-referrer", synchronous flag is set, credentials mode is "include", and whose use-URL-credentials flag is set.
  26. Let second manifest be the result of fetching request. HTTP caching semantics should again be honored for this request.

  27. If the previous step failed for any reason, or if the fetching attempt involved a redirect, or if second manifest and manifest are not byte-for-byte identical, then schedule a rerun of the entire algorithm with the same parameters after a short delay, and run the cache failure steps.

  28. Otherwise, store manifest in new cache, if it’s not there already, and categorize its entry as the manifest.

  29. Set the completeness flag of new cache to complete.
  30. Let task list be an empty list of tasks.
  31. If this is a cache attempt, then for each cache host associated with an application cache in cache group, create a task to fire a simple event that is cancelable named cached at the ApplicationCache singleton of the cache host, and append it to task list. The default action of these events must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that the application has been cached and that they can now use it offline.

    Otherwise, it is an upgrade attempt. For each cache host associated with an application cache in cache group, create a task to fire a simple event that is cancelable named updateready at the ApplicationCache singleton of the cache host, and append it to task list. The default action of these events must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that a new version is available and that they can activate it by reloading the page.

  32. If appropriate, remove any user interface indicating that an update for this cache is in progress.
  33. Set the update status of cache group to idle.
  34. For each task in task list, queue that task as a post-load task.

The cache failure steps are as follows:

  1. Let task list be an empty list of tasks.
  2. For each entry in cache group’s list of pending master entries, run the following further substeps. These steps may be run in parallel for two or more entries at a time.

    1. Wait for the resource for this entry to have either completely downloaded or failed.
    2. Unassociate the Document for this entry from its application cache, if it has one.
    3. Create a task to fire a simple event that is cancelable named error at the ApplicationCache singleton of the Document for this entry, if there still is one, and append it to task list. The default action of these events must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that the user agent failed to save the application for offline use.
  3. For each cache host still associated with an application cache in cache group, create a task to fire a simple event that is cancelable named error at the ApplicationCache singleton of the cache host, and append it to task list. The default action of these events must be, if the user agent shows caching progress, the display of some sort of user interface indicating to the user that the user agent failed to save the application for offline use.
  4. Empty cache group’s list of pending master entries.
  5. If cache group has an application cache whose completeness flag is incomplete, then discard that application cache.
  6. If appropriate, remove any user interface indicating that an update for this cache is in progress.
  7. Let the status of cache group be idle.
  8. If this was a cache attempt, discard cache group altogether.
  9. For each task in task list, queue that task as a post-load task.
  10. Abort the application cache download process.

Attempts to fetch resources as part of the application cache download process may be done with cache-defeating semantics, to avoid problems with stale or inconsistent intermediary caches.


User agents may invoke the application cache download process, in the background, for any application cache group, at any time (with no cache host). This allows user agents to keep caches primed and to update caches even before the user visits a site.


Each Document has a list of pending application cache download process tasks that is used to delay events fired by the algorithm above until the document’s load event has fired. When the Document is created, the list must be empty.

When the steps above say to queue a post-load task task, where task is a task that dispatches an event on a target ApplicationCache object target, the user agent must run the appropriate steps from the following list:

If target’s node document is ready for post-load tasks
Queue the task task.
Otherwise
Add task to target’s node document’s list of pending application cache download process tasks.

When the steps above say to queue a progress post-load task task, where task is a task that dispatches an event on a target ApplicationCache object target, the user agent must run the following steps:

  1. If there is a task in target’s node document’s list of pending application cache download process tasks that is labeled as a progress task, then remove that task from the list.
  2. Label task as a progress task.
  3. Queue a post-load task task.

The task source for these tasks is the networking task source.

11.3.4.3. The application cache selection algorithm

When the application cache selection algorithm algorithm is invoked with a Document document and optionally a manifest URL manifest URL, the user agent must run the first applicable set of steps from the following list:

If there is a manifest URL, and document was loaded from an application cache, and the URL of the manifest of that cache’s application cache group is not the same as manifest URL

Mark the entry for the resource from which document was taken in the application cache from which it was loaded as foreign.

Restart the current navigation from the top of the navigation algorithm, undoing any changes that were made as part of the initial load (changes can be avoided by ensuring that the step to update the session history with the new page is only ever completed after this application cache selection algorithm is run, though this is not required).

If document was loaded from an application cache, and that application cache still exists (it is not now obsolete)

Associate document with the application cache from which it was loaded. Invoke, in the background, the application cache download process for that application cache’s application cache group, with document as the cache host.

If document was loaded using GET, and, there is a manifest URL, and manifest URL has the same origin as document

Invoke, in the background, the application cache download process for manifest URL, with document as the cache host and with the resource from which document was parsed as the master resource.

If there are relevant application caches that are identified by a URL with the same origin as the URL of document, and that have this URL as one of their entries, excluding entries marked as foreign, then the user agent should use the most appropriate application cache of those that match as an HTTP cache for any subresource loads. User agents may also have other caches in place that are also honored.

Otherwise

The Document is not associated with any application cache.

If there was a manifest URL, the user agent may report to the user that it was ignored, to aid in application development.

11.3.4.4. Changes to the networking model

When a cache host is associated with an application cache whose completeness flag is complete, any and all loads for resources related to that cache host other than those for child browsing contexts must go through the following steps instead of immediately invoking the mechanisms appropriate to that resource’s scheme:

  1. If the resource is not to be fetched using the GET method, or if applying the URL parser algorithm to both its URL and the application cache’s manifest’s URL results in two URL records with different scheme components, then fetch the resource normally and abort these steps.
  2. If the resource’s URL is a master entry, the manifest, an explicit entry, or a fallback entry in the application cache, then get the resource from the cache (instead of fetching it), and abort these steps.
  3. If there is an entry in the application cache’s online safelist that has the same origin as the resource’s URL and that is a prefix match for the resource’s URL, then fetch the resource normally and abort these steps.
  4. If the resource’s URL has the same origin as the manifest’s URL, and there is a fallback namespace f in the application cache that is a prefix match for the resource’s URL, then:

    Fetch the resource normally. If this results in a redirect to a resource with another origin (indicative of a captive portal), or a 4xx or 5xx status code, or if there were network errors (but not if the user canceled the download), then instead get, from the cache, the resource of the fallback entry corresponding to the fallback namespace f. Abort these steps.

  5. If the application cache’s online safelist wildcard flag is open, then fetch the resource normally and abort these steps.
  6. Fail the resource load as if there had been a generic network error.

The above algorithm ensures that so long as the online safelist wildcard flag is blocking, resources that are not present in the manifest will always fail to load (at least, after the application cache has been primed the first time), making the testing of offline applications simpler.

11.3.4.5. Expiring application caches

As a general rule, user agents should not expire application caches, except on request from the user, or after having been left unused for an extended period of time.

Application caches and cookies have similar implications with respect to privacy (e.g., if the site can identify the user when providing the cache, it can store data in the cache that can be used for cookie resurrection). Implementors are therefore encouraged to expose application caches in a manner related to HTTP cookies, allowing caches to be expunged together with cookies and other origin-specific data.

11.3.4.6. Disk space

User agents should consider applying constraints on disk usage of application caches, and care should be taken to ensure that the restrictions cannot be easily worked around using subdomains.

User agents should allow users to see how much space each domain is using, and may offer the user the ability to delete specific application caches.

11.3.4.7. Security concerns with offline applications caches

This section is non-normative.

The main risk introduced by offline application caches is that an injection attack can be elevated into persistent site-wide page replacement. This attack involves using an injection vulnerability to upload two files to the victim site. The first file is an application cache manifest consisting of just a fallback entry pointing to the second file, which is an HTML page whose manifest is declared as that first file. Once the user has been directed to that second file, all subsequent accesses to any file covered by the given fallback namespace while either the user or the site is offline will instead show that second file. Targeted denial-of-service attacks or cookie bombing attacks (where the client is made to send so many cookies that the server refuses to process the request) can be used to ensure that the site appears offline.

To mitigate this, manifests can only specify fallbacks that are in the same path as the manifest itself. This means that a content injection upload vulnerability in a particular directory on a server can only be escalated to a take-over of that directory and its subdirectories. If there is no way to inject a file into the root directory, the entire site cannot be taken over.

If a site has been attacked in this way, simply removing the offending manifest might eventually clear the problem, since the next time the manifest is updated, a 404 error will be seen, and the user agent will clear the cache. "Eventually" is the key word here, however; while the attack on the user or server is ongoing, such that connections from an affected user to the affected site are blocked, the user agent will simply assume that the user is offline and will continue to use the hostile manifest. Unfortunately, if a cookie bombing attack has also been used, merely removing the manifest is insufficient; in addition, the server has to be configured to return a 404 or 410 response instead of the 413 "Request Entity Too Large" response.

TLS does not inherently protect a site from this attack, since the attack relies on content being served from the server itself. Not using application caches also does not prevent this attack, since the attack relies on an attacker-provided manifest.

11.3.4.8. Application cache API
[Exposed=(Window, SharedWorker)]
interface ApplicationCache : EventTarget {
  // update status
  const unsigned short UNCACHED = 0;
  const unsigned short IDLE = 1;
  const unsigned short CHECKING = 2;
  const unsigned short DOWNLOADING = 3;
  const unsigned short UPDATEREADY = 4;
  const unsigned short OBSOLETE = 5;
  readonly attribute unsigned short status;

  // updates
  void update();
  void abort();
  void swapCache();

  // events
  attribute EventHandler onchecking;
  attribute EventHandler onerror;
  attribute EventHandler onnoupdate;
  attribute EventHandler ondownloading;
  attribute EventHandler onprogress;
  attribute EventHandler onupdateready;
  attribute EventHandler oncached;
  attribute EventHandler onobsolete;
};
cache = window . applicationCache

(In a window.) Returns the ApplicationCache object that applies to the active document of that Window.

cache = self . applicationCache

(In a shared worker.) Returns the ApplicationCache object that applies to the current shared worker.

cache . status

Returns the current status of the application cache, as given by the constants defined below.

cache . update()

Invokes the application cache download process.

Throws an InvalidStateError exception if there is no application cache to update.

cache . abort()

Cancels the application cache download process.

cache . swapCache()

Switches to the most recent application cache, if there is a newer one. If there isn’t, throws an InvalidStateError exception.

There is a one-to-one mapping from cache hosts to ApplicationCache objects. The applicationCache attribute on Window objects must return the ApplicationCache object associated with the Window object’s active document. The applicationCache attribute on SharedWorkerGlobalScope objects must return the ApplicationCache object associated with the worker.

A Window or SharedWorkerGlobalScope object has an associated ApplicationCache object even if that cache host has no actual application cache.


The status attribute, on getting, must return the current state of the application cache that the ApplicationCache object’s cache host is associated with, if any. This must be the appropriate value from the following list:

UNCACHED (numeric value 0)
The ApplicationCache object’s cache host is not associated with an application cache at this time.
IDLE (numeric value 1)
The ApplicationCache object’s cache host is associated with an application cache whose application cache group’s update status is idle, and that application cache is the newest cache in its application cache group, and the application cache group is not marked as obsolete.
CHECKING (numeric value 2)
The ApplicationCache object’s cache host is associated with an application cache whose application cache group’s update status is checking.
DOWNLOADING (numeric value 3)
The ApplicationCache object’s cache host is associated with an application cache whose application cache group’s update status is downloading.
UPDATEREADY (numeric value 4)
The ApplicationCache object’s cache host is associated with an application cache whose application cache group’s update status is idle, and whose application cache group is not marked as obsolete, but that application cache is not the newest cache in its group.
OBSOLETE (numeric value 5)
The ApplicationCache object’s cache host is associated with an application cache whose application cache group is marked as obsolete.

If the update() method is invoked, the user agent must invoke the application cache download process, in the background, for the application cache group of the application cache with which the ApplicationCache object’s cache host is associated, but without giving that cache host to the algorithm. If there is no such application cache, or if its application cache group is marked as obsolete, then the method must throw an InvalidStateError exception instead.

If the abort() method is invoked, the user agent must send a signal to the current application cache download process for the application cache group of the application cache with which the ApplicationCache object’s cache host is associated, if any. If there is no such application cache, or it does not have a current application cache download process, then do nothing.

If the swapCache() method is invoked, the user agent must run the following steps:

  1. Check that ApplicationCache object’s cache host is associated with an application cache. If it is not, then throw an InvalidStateError exception and abort these steps.
  2. Let cache be the application cache with which the ApplicationCache object’s cache host is associated. (By definition, this is the same as the one that was found in the previous step.)
  3. If cache’s application cache group is marked as obsolete, then unassociate the ApplicationCache object’s cache host from cache and abort these steps. (Resources will now load from the network instead of the cache.)
  4. Check that there is an application cache in the same application cache group as cache whose completeness flag is complete and that is newer than cache. If there is not, then throw an InvalidStateError exception and abort these steps.
  5. Let new cache be the newest application cache in the same application cache group as cache whose completeness flag is complete.
  6. Unassociate the ApplicationCache object’s cache host from cache and instead associate it with new cache.

The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ApplicationCache interface:

Event handler Event handler event type
onchecking checking
onerror error
onnoupdate noupdate
ondownloading downloading
onprogress progress
onupdateready updateready
oncached cached
onobsolete obsolete

11.3.5. Other elements, attributes and APIs

User agents must treat acronym elements in a manner equivalent to abbr elements in terms of semantics and for purposes of rendering.


partial interface HTMLAnchorElement {
  attribute DOMString coords;
  attribute DOMString charset;
  attribute DOMString name;
  attribute DOMString shape;
};

The coords, charset, name, and shape IDL attributes of the th element must reflect the respective content attributes of the same name.


partial interface HTMLAreaElement {
  attribute boolean noHref;
};

The noHref IDL attribute of the area element must reflect the element’s nohref content attribute.


partial interface HTMLBodyElement {
  [TreatNullAs=EmptyString] attribute DOMString text;
  [TreatNullAs=EmptyString] attribute DOMString link;
  [TreatNullAs=EmptyString] attribute DOMString vLink;
  [TreatNullAs=EmptyString] attribute DOMString aLink;
  [TreatNullAs=EmptyString] attribute DOMString bgColor;
  attribute DOMString background;
};

The text IDL attribute of the body element must reflect the element’s text content attribute.

The link IDL attribute of the body element must reflect the element’s link content attribute.

The aLink IDL attribute of the body element must reflect the element’s alink content attribute.

The vLink IDL attribute of the body element must reflect the element’s vlink content attribute.

The bgColor IDL attribute of the body element must reflect the element’s bgcolor content attribute.

The background IDL attribute of the body element must reflect the element’s background content attribute. (The background content is not defined to contain a URL, despite rules regarding its handling in §10 Rendering above.)


partial interface HTMLBRElement {
  attribute DOMString clear;
};

The clear IDL attribute of the br element must reflect the content attribute of the same name.


partial interface HTMLTableCaptionElement {
  attribute DOMString align;
};

The align IDL attribute of the caption element must reflect the content attribute of the same name.


partial interface HTMLTableColElement {
  attribute DOMString align;
  attribute DOMString ch;
  attribute DOMString chOff;
  attribute DOMString vAlign;
  attribute DOMString width;
};

The align and width IDL attributes of the col element must reflect the respective content attributes of the same name.

The ch IDL attribute of the col element must reflect the element’s char content attribute.

The chOff IDL attribute of the col element must reflect the element’s charoff content attribute.

The vAlign IDL attribute of the col element must reflect the element’s valign content attribute.


User agents must treat dir elements in a manner equivalent to ul elements in terms of semantics and for purposes of rendering.

The dir element must implement the HTMLDirectoryElement interface.

interface HTMLDirectoryElement : HTMLElement {
  attribute boolean compact;
};

The compact IDL attribute of the dir element must reflect the content attribute of the same name.


partial interface HTMLDivElement {
  attribute DOMString align;
};

The align IDL attribute of the div element must reflect the content attribute of the same name.


partial interface HTMLDListElement {
  attribute boolean compact;
};

The compact IDL attribute of the dl element must reflect the content attribute of the same name.


partial interface HTMLEmbedElement {
  attribute DOMString align;
  attribute DOMString name;
};

The name and align IDL attributes of the embed element must reflect the respective content attributes of the same name.


The font element must implement the HTMLFontElement interface.

interface HTMLFontElement : HTMLElement {
  [TreatNullAs=EmptyString] attribute DOMString color;
  attribute DOMString face;
  attribute DOMString size;
};

The color, face, and size IDL attributes of the font element must reflect the respective content attributes of the same name.


partial interface HTMLHeadingElement {
  attribute DOMString align;
};

The align IDL attribute of the h1h6 elements must reflect the content attribute of the same name.


The profile IDL attribute on head elements (with the HTMLHeadElement interface) is intentionally omitted. Unless so required by another applicable specification, implementations would therefore not support this attribute. (It is mentioned here as it was defined in a previous version of the DOM specifications.)


partial interface HTMLHRElement {
  attribute DOMString align;
  attribute DOMString color;
  attribute boolean noShade;
  attribute DOMString size;
  attribute DOMString width;
};

The align, color, size, and width IDL attributes of the hr element must reflect the respective content attributes of the same name.

The noShade IDL attribute of the hr element must reflect the element’s noshade content attribute.


partial interface HTMLHtmlElement {
  attribute DOMString version;
};

The version IDL attribute of the html element must reflect the content attribute of the same name.


partial interface HTMLIFrameElement {
  attribute DOMString align;
  attribute DOMString scrolling;
  attribute DOMString frameBorder;
  attribute DOMString longDesc;

  [TreatNullAs=EmptyString] attribute DOMString marginHeight;
  [TreatNullAs=EmptyString] attribute DOMString marginWidth;
};

The align and scrolling IDL attributes of the iframe element must reflect the respective content attributes of the same name.

The frameBorder IDL attribute of the iframe element must reflect the element’s frameborder content attribute.

The longDesc IDL attribute of the iframe element must reflect the element’s longdesc content attribute, which for the purposes of reflection is defined as containing a URL.

The marginHeight IDL attribute of the iframe element must reflect the element’s marginheight content attribute.

The marginWidth IDL attribute of the iframe element must reflect the element’s marginwidth content attribute.


partial interface HTMLImageElement {
  attribute DOMString name;
  attribute DOMString lowsrc;
  attribute DOMString align;
  attribute unsigned long hspace;
  attribute unsigned long vspace;

  [TreatNullAs=EmptyString] attribute DOMString border;
};

The name, align, border, hspace, and vspace IDL attributes of the img element must reflect the respective content attributes of the same name.

The lowsrc IDL attribute of the img element must reflect the element’s lowsrc content attribute, which for the purposes of reflection is defined as containing a URL.


partial interface HTMLInputElement {
  attribute DOMString align;
  attribute DOMString useMap;
};

The align IDL attribute of the input element must reflect the content attribute of the same name.

The useMap IDL attribute of the input element must reflect the element’s usemap content attribute.


partial interface HTMLLegendElement {
  attribute DOMString align;
};

The align IDL attribute of the legend element must reflect the content attribute of the same name.


partial interface HTMLLIElement {
  attribute DOMString type;
};

The type IDL attribute of the li element must reflect the content attribute of the same name.


partial interface HTMLLinkElement {
  attribute DOMString charset;
  attribute DOMString target;
};

The charset and target IDL attributes of the link element must reflect the respective content attributes of the same name.


User agents must treat listing elements in a manner equivalent to pre elements in terms of semantics and for purposes of rendering.


partial interface HTMLMenuElement {
  attribute boolean compact;
};

The compact IDL attribute of the menu element must reflect the content attribute of the same name.


partial interface HTMLMetaElement {
  attribute DOMString scheme;
};

User agents may treat the scheme content attribute on the meta element as an extension of the element’s name content attribute when processing a meta element with a name attribute whose value is one that the user agent recognizes as supporting the scheme attribute.

User agents are encouraged to ignore the scheme attribute and instead process the value given to the metadata name as if it had been specified for each expected value of the scheme attribute.

For example, if the user agent acts on meta elements with name attributes having the value "eGMS.subject.keyword", and knows that the scheme attribute is used with this metadata name, then it could take the scheme attribute into account, acting as if it was an extension of the name attribute. Thus the following two meta elements could be treated as two elements giving values for two different metadata names, one consisting of a combination of "eGMS.subject.keyword" and "LGCL", and the other consisting of a combination of "eGMS.subject.keyword" and "ORLY":
<!-- this markup is invalid -->
<meta name="eGMS.subject.keyword" scheme="LGCL" content="Abandoned vehicles">
<meta name="eGMS.subject.keyword" scheme="ORLY" content="Mah car: kthxbye">

The suggested processing of this markup, however, would be equivalent to the following:

<meta name="eGMS.subject.keyword" content="Abandoned vehicles">
<meta name="eGMS.subject.keyword" content="Mah car: kthxbye">

The scheme IDL attribute of the meta element must reflect the content attribute of the same name.


partial interface HTMLObjectElement {
  attribute DOMString align;
  attribute DOMString archive;
  attribute DOMString code;
  attribute boolean declare;
  attribute unsigned long hspace;
  attribute DOMString standby;
  attribute unsigned long vspace;
  attribute DOMString codeBase;
  attribute DOMString codeType;
  attribute DOMString useMap;

  [TreatNullAs=EmptyString] attribute DOMString border;
};

The align, archive, border, code, declare, hspace, standby, and vspace IDL attributes of the object element must reflect the respective content attributes of the same name.

The codeBase IDL attribute of the object element must reflect the element’s codebase content attribute, which for the purposes of reflection is defined as containing a URL.

The codeType IDL attribute of the object element must reflect the element’s codetype content attribute.

The useMap IDL attribute of the object element must reflect the element’s usemap content attribute.


partial interface HTMLOListElement {
  attribute boolean compact;
};

The compact IDL attribute of the ol element must reflect the content attribute of the same name.


partial interface HTMLParagraphElement {
  attribute DOMString align;
};

The align IDL attribute of the p element must reflect the content attribute of the same name.


partial interface HTMLParamElement {
  attribute DOMString type;
  attribute DOMString valueType;
};

The type IDL attribute of the param element must reflect the content attribute of the same name.

The valueType IDL attribute of the param element must reflect the element’s valuetype content attribute.


User agents must treat plaintext elements in a manner equivalent to pre elements in terms of semantics and for purposes of rendering. (The parser has special behavior for this element, though.)


partial interface HTMLPreElement {
  attribute long width;
};

The width IDL attribute of the pre element must reflect the content attribute of the same name.


partial interface HTMLScriptElement {
  attribute DOMString event;
  attribute DOMString htmlFor;
};

The event IDL attribute of the script element must reflect the element’s event content attribute.

The htmlFor IDL attribute of the script element must reflect the element’s for content attribute.


partial interface HTMLTableElement {
  attribute DOMString align;
  attribute DOMString border;
  attribute DOMString frame;
  attribute DOMString rules;
  attribute DOMString summary;
  attribute DOMString width;

  [TreatNullAs=EmptyString] attribute DOMString bgColor;
  [TreatNullAs=EmptyString] attribute DOMString cellPadding;
  [TreatNullAs=EmptyString] attribute DOMString cellSpacing;
};

The align, border, frame, summary, rules, and width, IDL attributes of the table element must reflect the respective content attributes of the same name.

The bgColor IDL attribute of the table element must reflect the element’s bgcolor content attribute.

The cellPadding IDL attribute of the table element must reflect the element’s cellpadding content attribute.

The cellSpacing IDL attribute of the table element must reflect the element’s cellspacing content attribute.


partial interface HTMLTableSectionElement {
  attribute DOMString align;
  attribute DOMString ch;
  attribute DOMString chOff;
  attribute DOMString vAlign;
};

The align IDL attribute of the tbody, thead, and tfoot elements must reflect the content attribute of the same name.

The ch IDL attribute of the tbody, thead, and tfoot elements must reflect the elements' char content attributes.

The chOff IDL attribute of the tbody, thead, and tfoot elements must reflect the elements' charoff content attributes.

The vAlign IDL attribute of the tbody, thead, and tfoot element must reflect the elements' valign content attributes.


partial interface HTMLTableCellElement {
  attribute DOMString align;
  attribute DOMString axis;
  attribute DOMString height;
  attribute DOMString width;

  attribute DOMString ch;
  attribute DOMString chOff;
  attribute boolean noWrap;
  attribute DOMString vAlign;

  [TreatNullAs=EmptyString] attribute DOMString bgColor;
};

The align, axis, height, and width IDL attributes of the td and th elements must reflect the respective content attributes of the same name.

The ch IDL attribute of the td and th elements must reflect the elements' char content attributes.

The chOff IDL attribute of the td and th elements must reflect the elements' charoff content attributes.

The noWrap IDL attribute of the td and th elements must reflect the elements' nowrap content attributes.

The vAlign IDL attribute of the td and th element must reflect the elements' valign content attributes.

The bgColor IDL attribute of the td and th elements must reflect the elements' bgcolor content attributes.


partial interface HTMLTableDataCellElement {
  attribute DOMString abbr;
};

The abbr IDL attribute of the td element must reflect the respective content attributes of the same name.


partial interface HTMLTableRowElement {
  attribute DOMString align;
  attribute DOMString ch;
  attribute DOMString chOff;
  attribute DOMString vAlign;

  [TreatNullAs=EmptyString] attribute DOMString bgColor;
};

The align IDL attribute of the tr element must reflect the content attribute of the same name.

The ch IDL attribute of the tr element must reflect the element’s char content attribute.

The chOff IDL attribute of the tr element must reflect the element’s charoff content attribute.

The vAlign IDL attribute of the tr element must reflect the element’s valign content attribute.

The bgColor IDL attribute of the tr element must reflect the element’s bgcolor content attribute.


partial interface HTMLUListElement {
  attribute boolean compact;
  attribute DOMString type;
};

The compact and type IDL attributes of the ul element must reflect the respective content attributes of the same name.


User agents must treat xmp elements in a manner equivalent to pre elements in terms of semantics and for purposes of rendering. (The parser has special behavior for this element though.)


The blink, bgsound, isindex, multicol, nextid, and spacer elements must use the HTMLUnknownElement interface.


partial interface Document {
  [TreatNullAs=EmptyString] attribute DOMString fgColor;
  [TreatNullAs=EmptyString] attribute DOMString linkColor;
  [TreatNullAs=EmptyString] attribute DOMString vlinkColor;
  [TreatNullAs=EmptyString] attribute DOMString alinkColor;
  [TreatNullAs=EmptyString] attribute DOMString bgColor;

  [SameObject] readonly attribute HTMLCollection anchors;
  [SameObject] readonly attribute HTMLCollection applets;

  void clear();
  void captureEvents();
  void releaseEvents();

  [SameObject] readonly attribute HTMLAllCollection all;
};

The attributes of the Document object listed in the first column of the following table must reflect the content attribute on the body element with the name given in the corresponding cell in the second column on the same row, if the body element is a body element (as opposed to a frameset element). When there is no body element or if it is a frameset element, the attributes must instead return the empty string on getting and do nothing on setting.

IDL attribute Content attribute
fgColor text
linkColor link
vlinkColor vlink
alinkColor alink
bgColor bgcolor

The anchors attribute must return an HTMLCollection rooted at the Document node, whose filter matches only a elements with name attributes.

The applets attribute must return an HTMLCollection rooted at the Document node, whose filter matches only applet elements.

The clear(), captureEvents(), and releaseEvents() methods must do nothing.


The all attribute must return an HTMLAllCollection rooted at the Document node, whose filter matches all elements.

The object returned for all has several unusual behaviors:

These requirements are a willful violation of the JavaScript specification current at the time of writing (ECMAScript edition 6). The JavaScript specification requires that the ToBoolean() operator convert all objects to the true value, and does not have provisions for objects acting as if they were undefined for the purposes of certain operators. This violation is motivated by a desire for compatibility with two classes of legacy content: one that uses the presence of document.all as a way to detect legacy user agents, and one that only supports those legacy user agents and uses the document.all object without testing for its presence first. [ECMA-262]


partial interface Window {
  void captureEvents();
  void releaseEvents();

  [Replaceable, SameObject] readonly attribute External external;
};

The captureEvents() and releaseEvents() methods must do nothing.

The external attribute of the Window interface must return an instance of the External interface:

[NoInterfaceObject]
interface External {
  void AddSearchProvider();
  void IsSearchProviderInstalled();
};

The AddSearchProvider() and IsSearchProviderInstalled() methods must do nothing.