diff --git a/complete.html b/complete.html index 2f7675500b3..e56925adfc3 100644 --- a/complete.html +++ b/complete.html @@ -387,8 +387,7 @@
This section is non-normative.
-This specification is intended for authors of documents and - scripts that use the features defined in this specification, implementors of tools that operate on pages that use - the features defined in this specification, and individuals wishing - to establish the correctness of documents or implementations with - respect to the requirements of this specification.
+This specification is intended for authors of documents and scripts that use the features + defined in this specification, implementors of tools that operate on pages that + use the features defined in this specification, and individuals wishing to establish the + correctness of documents or implementations with respect to the requirements of this + specification.
-This document is probably not suited to readers who do not - already have at least a passing familiarity with Web technologies, - as in places it sacrifices clarity for precision, and brevity for - completeness. More approachable tutorials and authoring guides can - provide a gentler introduction to the topic.
+This document is probably not suited to readers who do not already have at least a passing + familiarity with Web technologies, as in places it sacrifices clarity for precision, and brevity + for completeness. More approachable tutorials and authoring guides can provide a gentler + introduction to the topic.
-In particular, familiarity with the basics of DOM Core and DOM - Events is necessary for a complete understanding of some of the more - technical parts of this specification. An understanding of Web IDL, - HTTP, XML, Unicode, character encodings, JavaScript, and CSS will - also be helpful in places but is not essential.
+In particular, familiarity with the basics of DOM is necessary for a complete understanding of + some of the more technical parts of this specification. An understanding of Web IDL, HTTP, XML, + Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not + essential.
This specification refers to both HTML and XML attributes and IDL - attributes, often in the same context. When it is not clear which is - being referred to, they are referred to as content - attributes for HTML and XML attributes, and IDL - attributes for those defined on IDL interfaces. Similarly, the - term "properties" is used for both JavaScript object properties and - CSS properties. When these are ambiguous they are qualified as object properties and CSS - properties respectively.
- -Generally, when the specification states that a feature applies - to the HTML syntax or the XHTML syntax, it - also includes the other. When a feature specifically only applies to - one of the two languages, it is called out by explicitly stating - that it does not apply to the other format, as in "for HTML, - ... (this does not apply to XHTML)".
- -This specification uses the term document to
- refer to any use of HTML, ranging from short static documents to
- long essays or reports with rich multimedia, as well as to
- fully-fledged interactive applications. The term is used to refer
- both to Document
objects and their descendant DOM
- trees, and to serialized byte streams using the HTML syntax or XHTML syntax, depending on context.
In the context of the DOM structures, the terms HTML document and XML
- document are used as defined in the DOM Core specification,
- and refer specifically to two different modes that
- Document
objects can find themselves in. [DOMCORE] (Such uses are always hyperlinked
- to their definition.)
In the context of byte streams, the term HTML document refers to
- resources labeled as text/html
, and the term XML
- document refers to resources labeled with an XML MIME
- type.
The term XHTML document is used to refer to both
- Document
s in the XML
- document mode that contains element nodes in the HTML
- namespace, and byte streams labeled with an XML MIME
- type that contain elements from the HTML
- namespace, depending on context.
For simplicity, terms such as shown, displayed, and visible might - sometimes be used when referring to the way a document is rendered - to the user. These terms are not meant to imply a visual medium; - they must be considered to apply to other media in equivalent - ways.
+This specification refers to both HTML and XML attributes and IDL attributes, often in the same + context. When it is not clear which is being referred to, they are referred to as content attributes for HTML and XML attributes, and IDL + attributes for those defined on IDL interfaces. Similarly, the term "properties" is used for + both JavaScript object properties and CSS properties. When these are ambiguous they are qualified + as object properties and CSS properties respectively.
+ +Generally, when the specification states that a feature applies to the HTML syntax + or the XHTML syntax, it also includes the other. When a feature specifically only + applies to one of the two languages, it is called out by explicitly stating that it does not apply + to the other format, as in "for HTML, ... (this does not apply to XHTML)".
+ +This specification uses the term document to refer to any use of HTML,
+ ranging from short static documents to long essays or reports with rich multimedia, as well as to
+ fully-fledged interactive applications. The term is used to refer both to Document
+ objects and their descendant DOM trees, and to serialized byte streams using the HTML syntax or XHTML syntax, depending
+ on context.
In the context of the DOM structures, the terms HTML
+ document and XML document are used as defined in the DOM
+ specification, and refer specifically to two different modes that Document
objects
+ can find themselves in. [DOM] (Such uses are always hyperlinked to their
+ definition.)
In the context of byte streams, the term HTML document refers to resources labeled as
+ text/html
, and the term XML document refers to resources labeled with an XML
+ MIME type.
The term XHTML document is used to refer to both Document
s in the XML document mode that contains element nodes in the HTML
+ namespace, and byte streams labeled with an XML MIME type that contain
+ elements from the HTML namespace, depending on context.
For simplicity, terms such as shown, displayed, and + visible might sometimes be used when referring to the way a document is + rendered to the user. These terms are not meant to imply a visual medium; they must be considered + to apply to other media in equivalent ways.
When an algorithm B says to return to another algorithm A, it - implies that A called B. Upon returning to A, the implementation - must continue from where it left off in calling B.
+When an algorithm B says to return to another algorithm A, it implies that A called B. Upon + returning to A, the implementation must continue from where it left off in calling B.
The term "transparent black" refers to the color with red, green, - blue, and alpha channels all set to zero.
+The term "transparent black" refers to the color with red, green, blue, and alpha channels all + set to zero.
The construction "a Foo
object", where
- Foo
is actually an interface, is sometimes used instead
- of the more accurate "an object implementing the interface
+
The construction "a Foo
object", where Foo
is actually an interface,
+ is sometimes used instead of the more accurate "an object implementing the interface
Foo
".
An IDL attribute is said to be getting when - its value is being retrieved (e.g. by author script), and is said to - be setting when a new value is assigned to - it.
+An IDL attribute is said to be getting when its value is being retrieved + (e.g. by author script), and is said to be setting when a new value is + assigned to it.
-If a DOM object is said to be live, then the - attributes and methods on that object must - operate on the actual underlying data, not a snapshot of the +
If a DOM object is said to be live, then the attributes and methods on that object + must operate on the actual underlying data, not a snapshot of the data.
In the contexts of events, the terms fire and dispatch are used as defined in the
- DOM Core specification: firing an event means to create and
- dispatch it, and dispatching an event means to follow the steps that propagate
+ DOM specification: firing an event means to create and dispatch it, and dispatching an event means to follow the steps that propagate
the event through the tree. The term trusted event is
used to refer to events whose isTrusted
attribute is
- initialized to true. [DOMCORE]
The Document Object Model (DOM) is a representation — a - model — of a document and its content. The DOM is not just - an API; the conformance criteria of HTML implementations are - defined, in this specification, in terms of operations on the DOM. - [DOMCORE]
+The Document Object Model (DOM) is a representation — a model — of a document and + its content. The DOM is not just an API; the conformance criteria of HTML implementations are + defined, in this specification, in terms of operations on the DOM. [DOM]
-Implementations must support DOM Core and the events defined in - DOM Events, because this specification is defined in terms of the - DOM, and some of the features are defined as extensions to the DOM - Core interfaces. [DOMCORE] [DOMEVENTS]
+Implementations must support DOM and the events defined in DOM Events, because this + specification is defined in terms of the DOM, and some of the features are defined as extensions + to the DOM interfaces. [DOM] [DOMEVENTS]
-In particular, the following features are defined in the DOM - Core specification: [DOMCORE]
+In particular, the following features are defined in the DOM specification: [DOM]
Attr
interfaceComment
interfaceisTrusted
attributeEventTarget
Document
MutationObserver
scripting environment conceptMutationObserver
objects algorithmThe term throw in this specification is used as
- defined in the DOM Core specification. The following
- DOMException
types are defined in the DOM Core
- specification: [DOMCORE]
The term throw in this specification is used as defined in the DOM specification.
+ The following DOMException
types are defined in the DOM specification: [DOM]
IndexSizeError
HierarchyRequestError
TimeoutError
InvalidNodeTypeError
DataCloneError
For example, to throw a
- TimeoutError
exception, a user agent would
- construct a DOMException
object whose type was the
- string "TimeoutError
" (and whose code was
- the number 23, for legacy reasons) and actually throw that object
- as an exception.
For example, to throw a TimeoutError
exception, a user
+ agent would construct a DOMException
object whose type was the string "TimeoutError
" (and whose code was the number 23, for legacy reasons) and
+ actually throw that object as an exception.
The URL associated
- with a Document
, as defined in the DOM Core
- specification, is referred to in this specification as the
- document's address.
The URL associated with a Document
, as
+ defined in the DOM specification, is referred to in this specification as the document's
+ address.
The following features are defined in the DOM Events - specification: [DOMEVENTS]
+The following features are defined in the DOM Events specification: [DOMEVENTS]
MouseEvent
interfaceMouseEventInit
dictionary typeThe following are base URL change steps, which run when an element is - affected by a base URL change (as defined by the DOM Core specification):
+ affected by a base URL change (as defined by the DOM specification):select
element on which the HTMLOptionsCollection
is rooted.Act as if the DOM Core insertBefore()
method
- was invoked on the parent node, with element as the first
+
Act as if the DOM insertBefore()
method was
+ invoked on the parent node, with element as the first
argument and reference as the second argument.
The remove(index)
method must act according to the following algorithm:
DOM3 Core defines mechanisms for checking for interface support, - and for obtaining implementations of interfaces, using feature - strings. [DOMCORE]
- -Authors are strongly discouraged from using these, as they are - notoriously unreliable and imprecise. Authors are encouraged to rely - on explicit feature testing or the graceful degradation behavior - intrinsic to some of the features in this specification.
For historical reasons, user agents should return the true value
- when the hasFeature(feature, version)
- method of the DOMImplementation
interface is invoked
- with feature set to either "HTML
" or "XHTML
" and version set to either "1.0
" or
- "2.0
".
There is an implied strong reference from any IDL attribute that returns a pre-existing object to that object.
@@ -9648,58 +9596,47 @@Every XML and HTML document in an HTML UA is represented by a
- Document
object. [DOMCORE]
Every XML and HTML document in an HTML UA is represented by a Document
object. [DOM]
The document's address is an absolute URL
- that is initially set when the Document
is created but
- that can change during the lifetime of the Document
,
- for example when the user navigates to
- a fragment identifier on the
- page or when the pushState()
method is called
- with a new URL.
The document's address is an absolute URL that is initially set when
+ the Document
is created but that can change during the lifetime of the
+ Document
, for example when the user navigates to a
+ fragment identifier on the page or when the pushState()
method is called with a new URL.
Interactive user agents typically expose - the document's address in their user interface. This is - the primary mechanism by which a user can tell if a site is +
Interactive user agents typically expose the document's address in + their user interface. This is the primary mechanism by which a user can tell if a site is attempting to impersonate another.
-When a Document
is created by a script using the createDocument()
- or createHTMLDocument()
- APIs, the document's address is the same as the
- document's address of the script's document, and
- the Document
is both ready for post-load
- tasks and completely loaded immediately.
Each Document
object has a reload override
- flag that is originally unset. The flag is set by the document.open()
and document.write()
methods in certain
- situations. When the flag is set, the Document
also has
- a reload override buffer which is a Unicode string that
- is used as the source of the document when it is reloaded.
When the user agent is to perform an overridden - reload, it must act as follows:
- -Let source be the value of the - browsing context's active document's - reload override buffer.
Navigate the
- browsing context to a resource whose source is source, with replacement enabled. When
- the navigate algorithm creates a Document
- object for this purpose, set that Document
's
- reload override flag and set its reload override
- buffer to source.
When a Document
is created by a script using
+ the createDocument()
or createHTMLDocument()
APIs, the
+ document's address is the same as the document's address of the script's
+ document, and the Document
is both ready for post-load tasks and
+ completely loaded immediately.
Each Document
object has a reload override flag that is originally
+ unset. The flag is set by the document.open()
and document.write()
methods in certain situations. When the flag is
+ set, the Document
also has a reload override buffer which is a Unicode
+ string that is used as the source of the document when it is reloaded.
When the user agent is to perform an overridden reload, it must act as follows:
+ +Let source be the value of the browsing context's + active document's reload override buffer.
Navigate the browsing context
+ to a resource whose source is source, with replacement enabled.
+ When the navigate algorithm creates a Document
object for this purpose,
+ set that Document
's reload override flag and set its reload
+ override buffer to source.
Document
objectThe DOM Core specification defines a Document
interface, which this specification
- extends significantly:
The DOM specification defines a Document
interface, which
+ this specification extends significantly:
[OverrideBuiltins] partial /*sealed*/ interface Document { @@ -10997,28 +10934,24 @@-3.2.3 Global attributes
3.2.3.1 The
-id
attributeThe
+id
attribute specifies its - element's unique identifier (ID). [DOMCORE]The
-id
attribute specifies its element's unique identifier (ID). [DOM]The value must be unique amongst all the IDs in the element's home - subtree and must contain at least one character. The value - must not contain any space - characters.
+The value must be unique amongst all the IDs in the element's + home subtree and must contain at least one character. The value must not contain any + space characters.
- + -An element's unique - identifier can be used for a variety of purposes, most - notably as a way to link to specific parts of a document using - fragment identifiers, as a way to target an element when scripting, - and as a way to style a specific element from CSS.
+An element's unique identifier can be used for a + variety of purposes, most notably as a way to link to specific parts of a document using fragment + identifiers, as a way to target an element when scripting, and as a way to style a specific + element from CSS.
-@@ -11538,38 +11471,32 @@Identifiers are opaque strings. Particular meanings should not be - derived from the value of the
+id
- attribute.Identifiers are opaque strings. Particular meanings should not be derived from the value of the +
id
attribute.3.2.3.6 The 3.2.3.7 The
-class
attributeEvery HTML element may have a -
+class
attribute specified.Every HTML element may have a
-class
attribute specified.The attribute, if specified, must have a value that is a - set of space-separated tokens representing the various - classes that the element belongs to.
+The attribute, if specified, must have a value that is a set of space-separated + tokens representing the various classes that the element belongs to.
--The classes that an HTML - element has assigned to it consists of all the classes - returned when the value of the
+class
- attribute is split on - spaces. (Duplicates are ignored.)The classes that an HTML element has assigned to it consists + of all the classes returned when the value of the
class
attribute + is split on spaces. (Duplicates are ignored.)Assigning classes to an element affects class - matching in selectors in CSS, the
+getElementsByClassName()
- method in the DOM, and other such features.Assigning classes to an element affects class matching in selectors in CSS, the +
-getElementsByClassName()
method in the + DOM, and other such features.There are no additional restrictions on the tokens authors can - use in the
+class
attribute, but - authors are encouraged to use values that describe the nature of the - content, rather than values that describe the desired presentation - of the content.There are no additional restrictions on the tokens authors can use in the
class
attribute, but authors are encouraged to use values that describe + the nature of the content, rather than values that describe the desired presentation of the + content.-@@ -16061,85 +15988,63 @@The
+className
andclassList
IDL attributes, - defined in the DOM Core specification, reflect the -class
content attribute. [DOMCORE]The
className
andclassList
IDL attributes, defined in the DOM + specification, reflect theclass
content attribute. + [DOM]4.3.1 The
text; };
The script
element allows authors to include dynamic
- script and data blocks in their documents. The element does not
- represent content for the user.
When used to include dynamic scripts, the scripts may either be
- embedded inline or may be imported from an external file using the
- src
attribute. If the language
- is not that described by "text/javascript
",
- then the type
attribute must
- be present, as described below. Whatever language is used, the
- contents of the script
element must conform with the
+
The script
element allows authors to include dynamic script and data blocks in
+ their documents. The element does not represent content for the
+ user.
When used to include dynamic scripts, the scripts may either be embedded inline or may be
+ imported from an external file using the src
attribute. If
+ the language is not that described by "text/javascript
", then the type
attribute must be present, as described below. Whatever
+ language is used, the contents of the script
element must conform with the
requirements of that language's specification.
When used to include data blocks (as opposed to scripts), the
- data must be embedded inline, the format of the data must be given
- using the type
attribute, the
- src
attribute must not be
- specified, and the contents of the script
element must
- conform to the requirements defined for the format used.
The type
- attribute gives the language of the script or format of the data. If
- the attribute is present, its value must be a valid MIME
- type. The charset
parameter must not be
- specified. The default, which is used if the attribute is absent,
- is "text/javascript
".
The src
- attribute, if specified, gives the address of the external script
- resource to use. The value of the attribute must be a valid
- non-empty URL potentially surrounded by spaces identifying a
- script resource of the type given by the type
attribute, if the attribute is
- present, or of the type "text/javascript
", if
- the attribute is absent. A resource is a script resource of a given
- type if that type identifies a scripting language and the resource
+
When used to include data blocks (as opposed to scripts), the data must be embedded inline, the
+ format of the data must be given using the type
attribute,
+ the src
attribute must not be specified, and the contents of
+ the script
element must conform to the requirements defined for the format used.
The type
attribute gives the language of the
+ script or format of the data. If the attribute is present, its value must be a valid MIME
+ type. The charset
parameter must not be specified. The default, which
+ is used if the attribute is absent, is "text/javascript
".
The src
attribute, if specified, gives the
+ address of the external script resource to use. The value of the attribute must be a valid
+ non-empty URL potentially surrounded by spaces identifying a script resource of the type
+ given by the type
attribute, if the attribute is present, or
+ of the type "text/javascript
", if the attribute is absent. A resource is a
+ script resource of a given type if that type identifies a scripting language and the resource
conforms with the requirements of that language's specification.
The charset
- attribute gives the character encoding of the external script
- resource. The attribute must not be specified if the src
attribute is not present. If the
- attribute is set, its value must be a valid character encoding name,
- must be an ASCII case-insensitive match for the
- preferred MIME name for that encoding, and must match
- the encoding given in the charset
parameter of
- the Content-Type metadata of the
- external file, if any. [IANACHARSET]
The async
and
- defer
attributes
- are boolean attributes that
- indicate how the script should be executed. The defer
and async
attributes must not be
- specified if the src
attribute
- is not present.
There are three possible modes that can be selected using these
- attributes. If the async
- attribute is present, then the script will be executed
- asynchronously, as soon as it is available. If the async
attribute is not present but
- the defer
attribute is
- present, then the script is executed when the page has finished
- parsing. If neither attribute is present, then the script is
- fetched and executed immediately, before the user agent continues
+
The charset
attribute gives the character
+ encoding of the external script resource. The attribute must not be specified if the src
attribute is not present. If the attribute is set, its value
+ must be a valid character encoding name, must be an ASCII case-insensitive match for
+ the preferred MIME name for that encoding, and must match the encoding given in the
+ charset
parameter of the Content-Type
+ metadata of the external file, if any. [IANACHARSET]
The async
and defer
attributes are boolean attributes that indicate how the script should be executed. The defer
and async
attributes
+ must not be specified if the src
attribute is not
+ present.
There are three possible modes that can be selected using these attributes. If the async
attribute is present, then the script will be executed
+ asynchronously, as soon as it is available. If the async
+ attribute is not present but the defer
attribute is
+ present, then the script is executed when the page has finished parsing. If neither attribute is
+ present, then the script is fetched and executed immediately, before the user agent continues
parsing the page.
The exact processing details for these attributes
- are, for mostly historical reasons, somewhat non-trivial, involving
- a number of aspects of HTML. The implementation requirements are
- therefore by necessity scattered throughout the specification. The
- algorithms below (in this section) describe the core of this
- processing, but these algorithms reference and are referenced by the
- parsing rules for script
start
- and end tags in HTML, in foreign content, and in XML, the rules for the document.write()
method, the
- handling of scripting, etc.
The defer
attribute may be
- specified even if the async
- attribute is specified, to cause legacy Web browsers that only
- support defer
(and not async
) to fall back to the defer
behavior instead of the
- synchronous blocking behavior that is the default.
The exact processing details for these attributes are, for mostly historical
+ reasons, somewhat non-trivial, involving a number of aspects of HTML. The implementation
+ requirements are therefore by necessity scattered throughout the specification. The algorithms
+ below (in this section) describe the core of this processing, but these algorithms reference and
+ are referenced by the parsing rules for script
start and end tags in HTML, in foreign content,
+ and in XML, the rules for the document.write()
method, the handling of scripting, etc.
The defer
attribute may be specified even if the async
attribute is specified, to cause legacy Web browsers that
+ only support defer
(and not async
) to fall back to the defer
behavior instead of the synchronous blocking behavior that
+ is the default.
The crossorigin
attribute is a
CORS settings attribute. It controls, for scripts that are obtained from other origins, whether error information will be exposed.
A script
element has several associated pieces of
- state.
A script
element has several associated pieces of state.
The first is a flag indicating whether or not the script block has been "already
+ started". Initially, script
elements must have this flag unset (script blocks,
+ when created, are not "already started"). The cloning
+ steps for script
elements must set the "already started" flag on the copy if
+ it is set on the element being cloned.
The second is a flag indicating whether the element was "parser-inserted".
+ Initially, script
elements must have this flag unset. It is set by the HTML
+ parser and the XML parser on script
elements they insert and
+ affects the processing of those elements.
The third is a flag indicating whether the element will "force-async". Initially,
+ script
elements must have this flag set. It is unset by the HTML parser
+ and the XML parser on script
elements they insert. In addition, whenever
+ a script
element whose "force-async" flag is set has a async
content attribute added, the element's
+ "force-async" flag must be unset.
The fourth is a flag indicating whether or not the script block is "ready to be
+ parser-executed". Initially, script
elements must have this flag unset (script
+ blocks, when created, are not "ready to be parser-executed"). This flag is used only for elements
+ that are also "parser-inserted", to let the parser know when to execute the
+ script.
The first is a flag indicating whether or not the script block
- has been "already started". Initially,
- script
elements must have this flag unset (script
- blocks, when created, are not "already started"). The cloning steps for
- script
elements must set the "already started" flag on
- the copy if it is set on the element being cloned.
The second is a flag indicating whether the element was
- "parser-inserted". Initially, script
- elements must have this flag unset. It is set by the HTML
- parser and the XML parser on script
- elements they insert and affects the processing of those
- elements.
The last few pieces of state are the script block's type, the
+ script block's character encoding, and the script block's fallback character
+ encoding. They are determined when the script is prepared, based on the attributes on
+ the element at that time, and the Document
of the script
element.
The third is a flag indicating whether the element will
- "force-async". Initially, script
elements
- must have this flag set. It is unset by the HTML parser
- and the XML parser on script
elements they
- insert. In addition, whenever a script
element whose
- "force-async" flag is set has a async
content attribute added, the
- element's "force-async" flag must be unset.
The fourth is a flag indicating whether or not the script block is
- "ready to be parser-executed". Initially,
- script
elements must have this flag unset (script
- blocks, when created, are not "ready to be parser-executed"). This
- flag is used only for elements that are also
- "parser-inserted", to let the parser know when to
- execute the script.
The last few pieces of state are the script block's
- type, the script block's character
- encoding, and the script block's fallback
- character encoding. They are determined when the script
- is prepared, based on the attributes on the element at that time,
- and the Document
of the script
- element.
When a script
element that is not marked as being
- "parser-inserted" experiences one of the events listed
- in the following list, the user agent must synchronously prepare the script
- element:
When a script
element that is not marked as being "parser-inserted"
+ experiences one of the events listed in the following list, the user agent must synchronously
+ prepare the script
element:
script
element gets inserted
into a document, at the time the node is inserted
@@ -16208,33 +16100,28 @@ script
elements inserted at that time.script
element is in a
- Document
and has a src
attribute set where previously
- the element had no such attribute.script
element is in a Document
and has a src
attribute set where previously the element had no such
+ attribute.To prepare a script, the user - agent must act as follows:
+To prepare a script, the user agent must act as + follows:
If the script
element is marked as having
- "already started", then the user agent must abort
- these steps at this point. The script is not executed.
If the script
element is marked as having "already started", then
+ the user agent must abort these steps at this point. The script is not executed.
If the element has its "parser-inserted" flag set, - then set was-parser-inserted to true and unset - the element's "parser-inserted" flag. Otherwise, set - was-parser-inserted to false.
+If the element has its "parser-inserted" flag set, then set was-parser-inserted to true and unset the element's + "parser-inserted" flag. Otherwise, set was-parser-inserted to + false.
-This is done so that if parser-inserted
- script
elements fail to run when the parser tries to
- run them, e.g. because they are empty or specify an unsupported
- scripting language, another script can later mutate them and cause
- them to run again.
This is done so that if parser-inserted script
elements fail to run
+ when the parser tries to run them, e.g. because they are empty or specify an unsupported
+ scripting language, another script can later mutate them and cause them to run again.
If was-parser-inserted is true and the
- element does not have an async
attribute, then set the
- element's "force-async" flag to true.
If was-parser-inserted is true and the element does not have an async
attribute, then set the element's
+ "force-async" flag to true.
This is done so that if a parser-inserted
- script
element fails to run when the parser tries to
- run it, but it is later executed after a script dynamically
- updates it, it will execute asynchronously even if the
- async
attribute isn't
- set.
This is done so that if a parser-inserted script
element fails to
+ run when the parser tries to run it, but it is later executed after a script dynamically updates
+ it, it will execute asynchronously even if the async
+ attribute isn't set.
If the element has no src
- attribute, and its child nodes, if any, consist only of comment
- nodes and empty Text
nodes, then the user agent must
- abort these steps at this point. The script is not executed.
If the element has no src
attribute, and its child
+ nodes, if any, consist only of comment nodes and empty Text
nodes, then the user
+ agent must abort these steps at this point. The script is not executed.
If the element is not in a Document
,
- then the user agent must abort these steps at this point. The
- script is not executed.
If the element is not in a Document
, then the user agent must abort
+ these steps at this point. The script is not executed.
script
element has a type
attribute and its value is
- the empty string, orscript
element has a type
attribute
+ and its value is the empty string, orscript
element has no type
attribute but it has a language
attribute and
- that attribute's value is the empty string, orscript
element has no type
attribute
+ but it has a language
attribute and that
+ attribute's value is the empty string, orscript
element has neither a type
attribute nor a language
attribute, thenscript
element has neither a type
+ attribute nor a language
attribute, then...let the script block's type for this
- script
element be "text/javascript
".
...let the script block's type for this script
element be "text/javascript
".
Otherwise, if the script
element has a type
attribute, let the
- script block's type for this script
element be
- the value of that attribute with any leading or trailing sequences
- of space characters
- removed.
Otherwise, if the script
element has a type
attribute, let the script block's type for this
+ script
element be the value of that attribute with any leading or trailing
+ sequences of space characters removed.
Otherwise, the element has a non-empty language
attribute; let
- the script block's type for this script
- element be the concatenation of the string "text/
" followed by the value of the language
attribute.
Otherwise, the element has a non-empty language
+ attribute; let the script block's type for this script
element be the
+ concatenation of the string "text/
" followed by the value of the language
attribute.
The language
attribute is never
- conforming, and is always ignored if there is a type
attribute present.
type
+ attribute present.
If the user agent does not support the scripting
- language given by the script block's type for
- this script
element, then the user agent must abort
+
If the user agent does not support the scripting language given by the
+ script block's type for this script
element, then the user agent must abort
these steps at this point. The script is not executed.
If was-parser-inserted is true, then flag - the element as "parser-inserted" again, and set the - element's "force-async" flag to false.
+If was-parser-inserted is true, then flag the element as + "parser-inserted" again, and set the element's "force-async" flag to + false.
The user agent must set the element's "already - started" flag.
+The user agent must set the element's "already started" flag.
-The state of the element at this moment is later used to - determine the script source.
+The state of the element at this moment is later used to determine the script source.
If the element is flagged as "parser-inserted",
- but the element's Document
is not the
- Document
of the parser that created the element, then
- abort these steps.
If the element is flagged as "parser-inserted", but the element's
+ Document
is not the Document
of the parser that created the element,
+ then abort these steps.
If scripting is
- disabled for the script
element, then the user
- agent must abort these steps at this point. The script is not
+
If scripting is disabled for the script
+ element, then the user agent must abort these steps at this point. The script is not
executed.
The definition of scripting is disabled means
- that, amongst others, the following scripts will not execute:
- scripts in XMLHttpRequest
's responseXML
- documents, scripts in DOMParser
-created documents,
- scripts in documents created by XSLTProcessor
's transformToDocument
- feature, and scripts that are first inserted by a script into a
- Document
that was created using the createDocument()
- API. [XHR] [DOMPARSING] [DOMCORE]
The definition of scripting is disabled
+ means that, amongst others, the following scripts will not execute: scripts in
+ XMLHttpRequest
's responseXML
+ documents, scripts in DOMParser
-created documents, scripts in documents created by
+ XSLTProcessor
's transformToDocument
feature, and scripts
+ that are first inserted by a script into a Document
that was created using the
+ createDocument()
API. [XHR] [DOMPARSING] [DOM]
If the script
element has an event
attribute and a for
attribute, then run these
- substeps:
If the script
element has an event
+ attribute and a for
attribute, then run these substeps:
Let for be the value of the for
attribute.
Let for be the value of the for
+ attribute.
Let event be the value of the event
attribute.
Strip leading and trailing whitespace from - event and for.
Strip leading and trailing whitespace from event and + for.
If for is not an ASCII
- case-insensitive match for the string "window
", then the user agent must abort these
- steps at this point. The script is not executed.
If for is not an ASCII case-insensitive match for the
+ string "window
", then the user agent must abort these steps at this
+ point. The script is not executed.
If event is not an ASCII
- case-insensitive match for either the string "onload
" or the string "onload()
", then the user agent must abort these
- steps at this point. The script is not executed.
If event is not an ASCII case-insensitive match for
+ either the string "onload
" or the string "onload()
", then the user agent must abort these steps at this point. The script
+ is not executed.
If the script
element has a charset
attribute, then let
- the script block's character encoding for this
+
If the script
element has a charset
+ attribute, then let the script block's character encoding for this
script
element be the encoding given by the charset
attribute.
Otherwise, let the script block's fallback character
- encoding for this script
element be the same as
- the encoding of the
- document itself.
Otherwise, let the script block's fallback character encoding for this
+ script
element be the same as the
+ encoding of the document itself.
Only one of these two pieces of state is set.
@@ -16400,8 +16275,8 @@If the element has a src
- content attribute, run these substeps:
If the element has a src
content attribute, run these
+ substeps:
Let src be the value of the element's src
attribute.
Then, the first of the following options that describes the - situation must be followed:
+Then, the first of the following options that describes the situation must be followed:
-src
attribute, and the element has
- a defer
attribute, and the
- element has been flagged as "parser-inserted", and
- the element does not have an async
attributesrc
+ attribute, and the element has a defer
attribute, and
+ the element has been flagged as "parser-inserted", and the element does not have
+ an async
attributeThe element must be added to the end of the list of
- scripts that will execute when the document has finished
- parsing associated with the Document
of the
- parser that created the element.
The element must be added to the end of the list of scripts that will execute when the
+ document has finished parsing associated with the Document
of the parser
+ that created the element.
The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must set the element's - "ready to be parser-executed" flag. The parser will - handle executing the script.
+The task that the networking task source + places on the task queue once the fetching algorithm + has completed must set the element's "ready to be parser-executed" flag. The + parser will handle executing the script.
src
attribute, and the
- element has been flagged as "parser-inserted", and
- the element does not have an async
attributesrc
attribute, and the element has been flagged as
+ "parser-inserted", and the element does not have an async
attributeThe element is the pending parsing-blocking
- script of the Document
of the parser that
- created the element. (There can only be one such script per
- Document
at a time.)
The element is the pending parsing-blocking script of the
+ Document
of the parser that created the element. (There can only be one such
+ script per Document
at a time.)
The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must set the element's - "ready to be parser-executed" flag. The parser will - handle executing the script.
+The task that the networking task source + places on the task queue once the fetching algorithm + has completed must set the element's "ready to be parser-executed" flag. The + parser will handle executing the script.
src
attribute, and
- the element has been flagged as "parser-inserted",
- and either the parser that created the script
is an
- XML parser or it's an HTML parser whose
- script nesting level is not greater than one, and the
- Document
of the HTML parser or
- XML parser that created the script
- element has a style sheet that is blocking
- scriptssrc
attribute, and the element has been flagged as
+ "parser-inserted", and either the parser that created the script
is
+ an XML parser or it's an HTML parser whose script nesting
+ level is not greater than one, and the Document
of the HTML
+ parser or XML parser that created the script
element has
+ a style sheet that is blocking scriptsThe element is the pending parsing-blocking
- script of the Document
of the parser that
- created the element. (There can only be one such script per
- Document
at a time.)
The element is the pending parsing-blocking script of the
+ Document
of the parser that created the element. (There can only be one such
+ script per Document
at a time.)
Set the element's "ready to be parser-executed" - flag. The parser will handle executing the script.
+Set the element's "ready to be parser-executed" flag. The parser will handle + executing the script.
src
attribute, does not have an
- async
attribute, and does
- not have the "force-async" flag setsrc
attribute, does not have an async
attribute, and does not have the
+ "force-async" flag setThe element must be added to the end of the list of
- scripts that will execute in order as soon as possible
- associated with the Document
of the
- script
element at the time the prepare a
- script algorithm started.
The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must run the following steps:
- -If the element is not now the first element in the - list of scripts that will execute in order as soon as - possible to which it was added above, then mark the - element as ready but abort these steps without executing the - script yet.
Execution: Execute the script block
- corresponding to the first script element in this list of
- scripts that will execute in order as soon as
+ The element must be added to the end of the list of scripts that will execute in order
+ as soon as possible associated with the The task that the networking task source
+ places on the task queue once the fetching algorithm
+ has completed must run the following steps: If the element is not now the first element in the list of scripts that will
+ execute in order as soon as possible to which it was added above, then mark the
+ element as ready but abort these steps without executing the script yet. Execution: Execute the script block corresponding to the first
+ script element in this list of scripts that will execute in order as soon as
possible. Remove the first element from this list of scripts
- that will execute in order as soon as possible. Remove the first element from this list of scripts that will execute in order as
+ soon as possible. If this list of scripts that will execute in order
- as soon as possible is still not empty and the first
- entry has already been marked as ready, then jump back to the
+ If this list of scripts that will execute in order as soon as possible is
+ still not empty and the first entry has already been marked as ready, then jump back to the
step labeled execution.Document
of the script
+ element at the time the prepare a script algorithm started.
src
attributesrc
+ attributeThe element must be added to the set of scripts that
- will execute as soon as possible of the
- Document
of the script
element at the
- time the prepare a script algorithm started.
The element must be added to the set of scripts that will execute as soon as
+ possible of the Document
of the script
element at the time the
+ prepare a script algorithm started.
The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must execute the script - block and then remove the element from the set of - scripts that will execute as soon as possible.
+The task that the networking task source + places on the task queue once the fetching algorithm + has completed must execute the script block and then remove the element from the + set of scripts that will execute as soon as possible.
Fetching an external script must delay the load - event of the element's document until the task that is queued by the networking task source once - the resource has been fetched (defined - above) has been run.
- -The pending parsing-blocking script of a
- Document
is used by the Document
's
- parser(s).
If a script
element that blocks a
- parser gets moved to another Document
before it would
- normally have stopped blocking that parser, it nonetheless continues
- blocking that parser until the condition that causes it to be
- blocking the parser no longer applies (e.g. if the script is a
- pending parsing-blocking script because there was
- a style sheet that is blocking scripts when it was
- parsed, but then the script is moved to another
- Document
before the style sheet loads, the script still
- blocks the parser until the style sheets are all loaded, at which
- time the script executes and the parser is unblocked).
When the user agent is required to execute a script block, it must run the following - steps:
+Fetching an external script must delay the load event of the element's document + until the task that is queued + by the networking task source once the resource has been fetched (defined above) has been run.
+ +The pending parsing-blocking script of a Document
is used by the
+ Document
's parser(s).
If a script
element that blocks a parser gets moved to another
+ Document
before it would normally have stopped blocking that parser, it nonetheless
+ continues blocking that parser until the condition that causes it to be blocking the parser no
+ longer applies (e.g. if the script is a pending parsing-blocking script because there
+ was a style sheet that is blocking scripts when it was parsed, but then the script is
+ moved to another Document
before the style sheet loads, the script still blocks the
+ parser until the style sheets are all loaded, at which time the script executes and the parser is
+ unblocked).
When the user agent is required to execute a script + block, it must run the following steps:
If the element is flagged as "parser-inserted",
- but the element's Document
is not the
- Document
of the parser that created the element, then
- abort these steps.
If the element is flagged as "parser-inserted", but the element's
+ Document
is not the Document
of the parser that created the element,
+ then abort these steps.
Executing the script block must just consist of firing a simple event named
- error
at the element.
Executing the script block must just consist of firing
+ a simple event named error
at the element.
Executing the script block must consist of running the
- following steps. For the purposes of these steps, the script is
- considered to be from an external file if, while the
- prepare a script algorithm above was running for
- this script, the script
element had a src
attribute specified.
Executing the script block must consist of running the following steps. For the purposes of
+ these steps, the script is considered to be from an external file if, while the
+ prepare a script algorithm above was running for this script, the
+ script
element had a src
attribute
+ specified.
Initialize the script block's source - as follows:
+Initialize the script block's source as follows:
-The contents of that file, interpreted as a Unicode - string, are the script source.
+The contents of that file, interpreted as a Unicode string, are the script source.
-To obtain the Unicode string, the user agent run the - following steps:
+To obtain the Unicode string, the user agent run the following steps:
-If the resource's Content - Type metadata, if any, specifies a character - encoding, and the user agent supports that encoding, then - let character encoding be that - encoding, and jump to the bottom step in this series of - steps.
If the resource's Content Type metadata, if any, + specifies a character encoding, and the user agent supports that encoding, then let character encoding be that encoding, and jump to the bottom step in this + series of steps.
If the algorithm above set the script block's - character encoding, then let character - encoding be that encoding, and jump to the bottom - step in this series of steps.
If the algorithm above set the script block's character encoding, then + let character encoding be that encoding, and jump to the bottom step + in this series of steps.
For each of the rows in the following table, - starting with the first one and going down, if the file has - as many or more bytes available than the number of bytes in - the first column, and the first bytes of the file match the - bytes given in the first column, then set character encoding to the encoding given in - the cell in the second column of that row, and jump to the - bottom step in this series of steps:
+For each of the rows in the following table, starting with the first one and going + down, if the file has as many or more bytes available than the number of bytes in the + first column, and the first bytes of the file match the bytes given in the first column, + then set character encoding to the encoding given in the cell in the + second column of that row, and jump to the bottom step in this series of steps:
Bytes in Hexadecimal
@@ -16708,53 +16538,47 @@ 4.3.1 The UTF-EBCDIC
-->
- | |
---|
This step looks for Unicode Byte Order - Marks (BOMs).
+This step looks for Unicode Byte Order Marks (BOMs).
Let character encoding be - the script block's fallback character - encoding.
Let character encoding be the script block's fallback + character encoding.
Convert the file to Unicode using character
- encoding, following the rules for doing so given by
- the specification for the script block's
+ Convert the file to Unicode using character encoding, following the
+ rules for doing so given by the specification for the script block's
type.
The external file is the script source. When it is later - executed, it must be interpreted in a manner consistent with - the specification defining the language given by the - script block's type.
+The external file is the script source. When it is later executed, it must be + interpreted in a manner consistent with the specification defining the language given by + the script block's type.
The value of the text
IDL attribute at the
- time the element's "already started" flag was
- last set is the script source.
The value of the text
IDL attribute at the time
+ the element's "already started" flag was last set is the script source.
The child nodes of the script
element at the
- time the element's "already started" flag was
- last set are the script source.
The child nodes of the script
element at the time the element's
+ "already started" flag was last set are the script source.
Fire a simple event named beforescriptexecute
- that bubbles and is cancelable at the script
- element.
Fire a simple event named beforescriptexecute
that bubbles and is cancelable
+ at the script
element.
If the event is canceled, then abort these steps.
@@ -16773,8 +16596,8 @@If the script is from an external file, then increment the
- ignore-destructive-writes counter of the
- script
element's Document
. Let neutralized doc be that
+ ignore-destructive-writes counter of the script
element's
+ Document
. Let neutralized doc be that
Document
.
Create a
- script from the script
element node, using
- the script block's source, the URL
- from which the script was obtained, and the script
- block's type.
Create a script from the
+ script
element node, using the script block's source, the
+ URL from which the script was obtained, and the script block's
+ type.
If the script came from a resource that was fetched in the steps above, and the resource was CORS-cross-origin, then pass the muted errors flag to the create a script from a node algorithm.
-This is where the script is compiled and - actually executed.
+This is where the script is compiled and actually executed.
@@ -16820,28 +16641,24 @@Decrement the ignore-destructive-writes - counter of neutralized doc, if it - was incremented in the earlier step.
+Decrement the ignore-destructive-writes counter of neutralized + doc, if it was incremented in the earlier step.
Fire a simple event named afterscriptexecute
- that bubbles (but is not cancelable) at the
- script
element.
Fire a simple event named afterscriptexecute
that bubbles (but is not
+ cancelable) at the script
element.
If the script is from an external file, fire a simple
- event named load
at the
- script
element.
If the script is from an external file, fire a simple event named load
at the script
element.
Otherwise, the script is internal; queue a
- task to fire a simple event named load
at the script
+
Otherwise, the script is internal; queue a task to fire a simple
+ event named load
at the script
element.
The IDL attributes src
, type
, charset
, defer
, each must
- reflect the respective content attributes of the same
- name.
The IDL attributes src
, type
, charset
, defer
, each must reflect the respective
+ content attributes of the same name.
The crossOrigin
IDL attribute must
reflect the crossorigin
content
attribute.
The async
IDL
- attribute controls whether the element will execute asynchronously
- or not. If the element's "force-async" flag is set,
- then, on getting, the async
- IDL attribute must return true, and on setting, the
- "force-async" flag must first be unset, and then the
- content attribute must be removed if the IDL attribute's new value
- is false, and must be set to the empty string if the IDL attribute's
- new value is true. If the element's "force-async" flag
- is not set, the IDL attribute must reflect the
- async
content attribute.
The async
IDL attribute controls whether the
+ element will execute asynchronously or not. If the element's "force-async" flag is
+ set, then, on getting, the async
IDL attribute must return
+ true, and on setting, the "force-async" flag must first be unset, and then the
+ content attribute must be removed if the IDL attribute's new value is false, and must be set to
+ the empty string if the IDL attribute's new value is true. If the element's
+ "force-async" flag is not set, the IDL attribute must reflect
+ the async
content attribute.
Returns the contents of the element, ignoring child nodes that
- aren't Text
nodes.
Returns the contents of the element, ignoring child nodes that aren't Text
+ nodes.
Can be set, to replace the element's children with the given - value.
+Can be set, to replace the element's children with the given value.
The IDL attribute text
must return a
- concatenation of the contents of all the Text
nodes
- that are children of the script
element (ignoring any
- other nodes such as comments or elements), in tree order. On
- setting, it must act the same way as the textContent
- IDL attribute.
Text
nodes that are children of the
+ script
element (ignoring any other nodes such as comments or elements), in tree
+ order. On setting, it must act the same way as the textContent
IDL attribute.
When inserted using the document.write()
method,
- script
elements execute (typically synchronously), but
- when inserted using innerHTML
and outerHTML
attributes, they do not
- execute at all.
When inserted using the document.write()
+ method, script
elements execute (typically synchronously), but when inserted using
+ innerHTML
and outerHTML
+ attributes, they do not execute at all.
In this example, two script
elements are used. One
- embeds an external script, and the other includes some data.
In this example, two script
elements are used. One embeds an external script, and
+ the other includes some data.
<script src="game-engine.js"></script> <script type="text/x-game-map"> @@ -16915,22 +16725,19 @@4.3.1 The
- The data in this case might be used by the script to generate - the map of a video game. The data doesn't have to be used that way, - though; maybe the map data is actually embedded in other parts of - the page's markup, and the data block here is just used by the - site's search engine to help users who are looking for particular - features in their game maps.
+The data in this case might be used by the script to generate the map of a video game. The + data doesn't have to be used that way, though; maybe the map data is actually embedded in other + parts of the page's markup, and the data block here is just used by the site's search engine to + help users who are looking for particular features in their game maps.
The following sample shows how a script element can be used to
- define a function that is then used by other parts of the
- document. It also shows how a script
element can be
- used to invoke script while the document is being parsed, in this
- case to initialize the form's output.
The following sample shows how a script element can be used to define a function that is then
+ used by other parts of the document. It also shows how a script
element can be used
+ to invoke script while the document is being parsed, in this case to initialize the form's
+ output.
<script> function calculate(form) { @@ -22502,15 +22309,13 @@4.6.21 The
rubyGlobal attributes
DOM interface: Uses -HTMLElement
.The
+ruby
element allows one or more spans of - phrasing content to be marked with ruby annotations. Ruby - annotations are short runs of text presented alongside base text, - primarily used in East Asian typography as a guide for - pronunciation or to include other annotations. In Japanese, this - form of typography is also known as furigana.The
-ruby
element allows one or more spans of phrasing content to be marked with + ruby annotations. Ruby annotations are short runs of text presented alongside base text, primarily + used in East Asian typography as a guide for pronunciation or to include other annotations. In + Japanese, this form of typography is also known as furigana.The content model of
+ruby
elements consists of one - or more of the following sequences:The content model of
ruby
elements consists of one or more of the following + sequences:
- One or the other of the following:
The
+ruby
andrt
elements can be used - for a variety of kinds of annotations, including in particular those - described below. For more details on Japanese Ruby in particular, - and how to render Ruby for Japanese, see Requirements for - Japanese Text Layout. [JLREQ]The
-ruby
andrt
elements can be used for a variety of kinds of + annotations, including in particular those described below. For more details on Japanese Ruby in + particular, and how to render Ruby for Japanese, see Requirements for Japanese Text + Layout. [JLREQ]At the time of writing, CSS does not yet provide a - way to fully control the rendering of the HTML
+ruby
- element. It is hoped that CSS will be extended to support the styles - described below in due course.At the time of writing, CSS does not yet provide a way to fully control the + rendering of the HTML
@@ -22556,11 +22359,10 @@ruby
element. It is hoped that CSS will be extended to support + the styles described below in due course.4.6.21 The
ruby -
This is similar to the previous case: each ideographic - character in the compound word (the base text) has its reading - given in hiragana or katakana characters (the ruby annotation). - The difference is that the base text segments form a compound word - rather than being separate from each other. +
This is similar to the previous case: each ideographic character in the compound word (the + base text) has its reading given in hiragana or katakana characters (the ruby annotation). The + difference is that the base text segments form a compound word rather than being separate from + each other.
<ruby>B<rt>annotation</rt>B<rt>annotation</ruby>@@ -22581,11 +22383,9 @@4.6.21 The
ruby -
This is semantically identical to the previous case (each - individual ideographic character in the base compound word has its - reading given in an annotation in hiragana or katakana - characters), but the rendering is the more complicated Jukugo Ruby - rendering. +
This is semantically identical to the previous case (each individual ideographic character in + the base compound word has its reading given in an annotation in hiragana or katakana + characters), but the rendering is the more complicated Jukugo Ruby rendering.
-This is the same example as above for mono-ruby for compound words. The different rendering is expected to be achieved using different styling (e.g. in CSS), and is not shown here.
@@ -22596,9 +22396,8 @@4.6.21 The
ruby
For more details on Jukugo - Ruby rendering, see Appendix F in the Requirements for - Japanese Text Layout. [JLREQ]
+For more details on Jukugo Ruby rendering, see + Appendix F in the Requirements for Japanese Text Layout. [JLREQ]
@@ -22607,9 +22406,8 @@4.6.21 The
ruby -
The annotation describes the meaning of the base text, rather - than (or in addition to) the pronunciation. As such, both the base - text and the annotation can be multiple characters long. +
The annotation describes the meaning of the base text, rather than (or in addition to) the + pronunciation. As such, both the base text and the annotation can be multiple characters long.
<ruby>BASE<rt>annotation</ruby>@@ -22632,11 +22430,10 @@4.6.21 The
ruby -
A phonetic reading that corresponds to multiple base - characters, because a one-to-one mapping would be difficult. (In - English, the words "Colonel" and "Lieutenant" are examples of - words where a direct mapping of pronunciation to individual - letters is, in some dialects, rather unclear.) +
A phonetic reading that corresponds to multiple base characters, because a one-to-one mapping + would be difficult. (In English, the words "Colonel" and "Lieutenant" are examples of words + where a direct mapping of pronunciation to individual letters is, in some dialects, rather + unclear.)
In this example, the name of a species of flowers has a phonetic reading provided using group ruby: @@ -22674,48 +22471,38 @@
4.6.21 The
ruby -
Within a
- -ruby
element that does not have a -ruby
element ancestor, content is segmented and - segments are placed into three categories: base text segments, - annotation segments, and ignored segments. Ignored segments do not - form part of the document's semantics (they consist of some - inter-element whitespace andrp
elements, - the latter of which are used for legacy user agents that do not - support ruby at all). Base text segments can overlap (with a limit - of two segments overlapping any one position in the DOM, and with - any segment having an earlier start point than an overlapping - segment also having an equal or later end point, and any segment - have a later end point than an overlapping segment also having an - equal or earlier start point). Annotation - segments correspond tort
elements. Each annotation - segment can be associated with a base text segment, and each base - text segment can have annotation segments associated with it. (In a - conforming document, each base text segment is associated with at - least one annotation segment, and each annotation segment is - associated with one base text segment.) Aruby
element - represents the union of the segments of base text it - contains, along with the mapping from those base text segments to - annotation segments. Segments are described in terms of DOM ranges; - annotation segment ranges always consist of exactly one element. [DOMCORE]At any particular time, the segmentation and categorisation of - content of a
- -ruby
element is the result that would be - obtained from running the following algorithm:
- - -
Let base text segments be an empty list - of base text segments, each potentially with a list of base text - subsegments.
- - -
Let annotation segments be an empty list - of annotation segments, each potentially being associated with a - base text segment or subsegment.
- - -
Let root be the
ruby
- element for which the algorithm is being run.- +
If root has a
ruby
element - ancestor, then jump to the step labeled end.Within a
+ +ruby
element that does not have aruby
element ancestor, + content is segmented and segments are placed into three categories: base text segments, annotation + segments, and ignored segments. Ignored segments do not form part of the document's semantics + (they consist of some inter-element whitespace andrp
elements, the + latter of which are used for legacy user agents that do not support ruby at all). Base text + segments can overlap (with a limit of two segments overlapping any one position in the DOM, and + with any segment having an earlier start point than an overlapping segment also having an equal or + later end point, and any segment have a later end point than an overlapping segment also having an + equal or earlier start point). Annotation segments correspond tort
elements. Each annotation + segment can be associated with a base text segment, and each base text segment can have annotation + segments associated with it. (In a conforming document, each base text segment is associated with + at least one annotation segment, and each annotation segment is associated with one base text + segment.) Aruby
element represents the union of the segments of base + text it contains, along with the mapping from those base text segments to annotation segments. + Segments are described in terms of DOM ranges; annotation segment ranges always consist of exactly + one element. [DOM]At any particular time, the segmentation and categorisation of content of a
+ +ruby
+ element is the result that would be obtained from running the following algorithm:
- + +
Let base text segments be an empty list of base text segments, each + potentially with a list of base text subsegments.
- + +
Let annotation segments be an empty list of annotation segments, each + potentially being associated with a base text segment or subsegment.
- + +
Let root be the
ruby
element for which the algorithm is + being run.If root has a
ruby
element ancestor, then jump to the + step labeled end.- @@ -22728,165 +22515,153 @@
Let current parent be root.
4.6.21 The
ruby
Let current base text be null. - + -
Start mode: If index is equal to - or greater than the number of child nodes in current - parent, then jump to the step labeled end mode.
+Start mode: If index is equal to or greater than the number of + child nodes in current parent, then jump to the step labeled end + mode.
-If the indexth node in current parent is an
rt
or -rp
element, jump to the step labeled annotation +- - +
If the indexth node in current parent is an +
rt
orrp
element, jump to the step labeled annotation mode.- -
Set start index to the value of index.
- +
Base mode: If the indexth node in - current parent is a
ruby
element, - and if current parent is the same element as - root, then push a ruby level and - then jump to the step labeled start mode.- -
Base mode: If the indexth node in current + parent is a
ruby
element, and if current parent is the + same element as root, then push a ruby level and then jump to + the step labeled start mode.- +
If the indexth node in current parent is an
rt
or -rp
element, then set the current base - text and then jump to the step labeled annotation - mode.If the indexth node in current parent is an +
rt
orrp
element, then set the current base text and then + jump to the step labeled annotation mode.- -
Increment index by one.
- +
Base mode post-increment: If index is equal to or greater than the number of - child nodes in current parent, then jump to the - step labeled end mode.
Base mode post-increment: If index is equal to or greater than + the number of child nodes in current parent, then jump to the step labeled + end mode.
- -
Jump back to the step labeled base mode.
- +
Annotation mode: If the indexth - node in current parent is an
rt
- element, then push a ruby annotation and jump to the - step labeled annotation mode increment.- -
Annotation mode: If the indexth node in current + parent is an
rt
element, then push a ruby annotation and jump to + the step labeled annotation mode increment.- +
If the indexth node in current parent is an
rp
element, jump - to the step labeled annotation mode increment.- -
If the indexth node in current parent is an +
rp
element, jump to the step labeled annotation mode increment.- +
If the indexth node in current parent is not a
Text
node, or - is aText
node that is not inter-element - whitespace, then jump to the step labeled base - mode.- -
If the indexth node in current parent is not a +
Text
node, or is aText
node that is not inter-element + whitespace, then jump to the step labeled base mode.- +
Annotation mode increment: Let lookahead index be index plus - one.
- -
Annotation mode increment: Let lookahead index be index plus one.
Annotation mode white-space skipper: If lookahead index is equal to the number of child - nodes in current parent then jump to the step +
- -
Annotation mode white-space skipper: If lookahead index is + equal to the number of child nodes in current parent then jump to the step labeled end mode.
- +
If the lookahead indexth node in current parent is an
rt
element or an -rp
element, then set index to lookahead index and jump to the step labeled - annotation mode.- -
If the lookahead indexth node in current parent is + an
rt
element or anrp
element, then set index to + lookahead index and jump to the step labeled annotation mode.- +
If the lookahead indexth node in current parent is not a
Text
node, or - is aText
node that is not inter-element - whitespace, then jump to the step labeled base mode - (without further incrementing index, so the - inter-element whitespace seen so far becomes part of - the next base text segment).- -
If the lookahead indexth node in current parent is + not a
Text
node, or is aText
node that is not inter-element + whitespace, then jump to the step labeled base mode (without further incrementing + index, so the inter-element whitespace seen so far becomes part + of the next base text segment).- +
Increment lookahead index by - one.
- -
Increment lookahead index by one.
- +
Jump to the step labeled annotation mode white-space - skipper.
- -
Jump to the step labeled annotation mode white-space skipper.
End mode: If current parent is - not the same element as root, then pop a - ruby level and jump to the step labeled base mode +
- -
End mode: If current parent is not the same element as root, then pop a ruby level and jump to the step labeled base mode post-increment.
- +
End: Return base text segments - and annotation segments. Any content of the -
ruby
element not described by segments in either of - thost lists is implicitly in an ignored segment.- -
End: Return base text segments and annotation + segments. Any content of the
ruby
element not described by segments in either + of thost lists is implicitly in an ignored segment.When the steps above say to set the current base text, - it means to run the following steps at that point in the - algorithm:
+When the steps above say to set the current base text, it means to run the following + steps at that point in the algorithm:
-
- +
Let text range a DOM range whose start is the boundary point (current parent, start index) and - whose end is the boundary point (current parent, index).
- -
Let text range a DOM range whose start is the boundary + point (current parent, start index) and whose + end is the boundary + point (current parent, index).
Let new text segment be a base text - segment described by the range annotation - range.
+Let new text segment be a base text segment described by the range + annotation range.
-- +
Add new text segment to base text segments.
- -
Add new text segment to base text + segments.
- +
Let current base text be new text segment.
Let current base text be new text + segment.
- -
Let start index be null.
When the steps above say to push a ruby level, it - means to run the following steps at that point in the algorithm:
+When the steps above say to push a ruby level, it means to run the following steps + at that point in the algorithm:
-
- +
Let current parent be the indexth node in current - parent.
Let current parent be the indexth node in current parent.
- -
Let index be 0.
- +
Set saved start index to the value of - start index.
Set saved start index to the value of start + index.
- -
Let start index be null.
When the steps above say to pop a ruby level, it means - to run the following steps at that point in the algorithm:
+When the steps above say to pop a ruby level, it means to run the following steps at + that point in the algorithm:
-
- +
Let index be the position of current parent in root.
Let index be the position of current parent in + root.
Let current parent be root.
- -
Increment index by one.
- +
Set start index to the value of - saved start index.
Set start index to the value of saved start + index.
- -
Let saved start index be null.
When the steps above say to push a ruby annotation, it - means to run the following steps at that point in the algorithm:
+When the steps above say to push a ruby annotation, it means to run the following + steps at that point in the algorithm:
-
- +
Let rt be the
rt
element - that is the indexth node of current parent.
- -
Let rt be the
rt
element that is the indexth node of current parent.- +
Let annotation range a DOM range whose - start is the boundary point (current parent, index) and whose - end is the boundary point (current parent, index plus one) - (i.e. that contains only rt).
- -
Let annotation range a DOM range whose start is the boundary + point (current parent, index) and whose end is the boundary point + (current parent, index plus one) (i.e. that contains only + rt).
- +
Let new annotation segment be an - annotation segment described by the range annotation - range.
- -
Let new annotation segment be an annotation segment described by the + range annotation range.
- +
If current base text is not null, - associate new annotation segment with current base text.
- -
If current base text is not null, associate new + annotation segment with current base text.
- +
Add new annotation segment to annotation segments.
Add new annotation segment to annotation + segments.
-@@ -26480,6 +26246,9 @@In this example, each ideograph in the Japanese text 漢字 is annotated with its - reading in hiragana.
+In this example, each ideograph in the Japanese text 漢字 is annotated with its reading in hiragana.
... <ruby>漢<rt>かん</rt>字<rt>じ</rt></ruby> @@ -22902,9 +22677,7 @@4.6.21 The
ruby -
In this example, each ideograph in the traditional Chinese text - 漢字 is annotated - with its bopomofo reading.
+In this example, each ideograph in the traditional Chinese text 漢字 is annotated with its bopomofo reading.
<ruby>漢<rt>ㄏㄢˋ</rt>字<rt>ㄗˋ</rt></ruby>@@ -22918,9 +22691,7 @@4.6.21 The
ruby -
In this example, each ideograph in the simplified Chinese text - 汉字 is annotated - with its pinyin reading.
+In this example, each ideograph in the simplified Chinese text 汉字 is annotated with its pinyin reading.
...<ruby>汉<rt>hàn</rt>字<rt>zì</rt></ruby>...@@ -22934,11 +22705,10 @@4.6.21 The
ruby -
In this more contrived example, the acronym "HTML" has four - annotations: one for the whole acronym, briefly describing what it - is, one for the letters "HT" expanding them to "Hypertext", one for - the letter "M" expanding it to "Markup", and one for the letter "L" - expanding it to "Language".
+In this more contrived example, the acronym "HTML" has four annotations: one for the whole + acronym, briefly describing what it is, one for the letters "HT" expanding them to "Hypertext", + one for the letter "M" expanding it to "Markup", and one for the letter "L" expanding it to + "Language".
<ruby> <ruby>HT<rt>Hypertext</rt>M<rt>Markup</rt>L<rt>Language</rt></ruby> @@ -24841,21 +24611,17 @@4.8.1 The
img
<- The
img
element is completely available.Otherwise, the attribute must return false.
-The value of
+complete
can thus change while a - script is executing.The value of
-complete
can thus change while + a script is executing.Three constructors are provided for creating -
+HTMLImageElement
objects (in addition to the factory - methods from DOM Core such ascreateElement()
):Image()
,Image(width)
, andImage(width, height)
. When invoked as constructors, - these must return a newHTMLImageElement
object (a new -img
element). If the width argument - is present, the new object'swidth
content attribute must be set to - width. If the height - argument is also present, the new object'sheight
content attribute must be set - to height. The element's document must be the - active document of the browsing context of - theWindow
object on which the interface object of the - invoked constructor is found.Three constructors are provided for creating
HTMLImageElement
objects (in addition + to the factory methods from DOM such ascreateElement()
):Image()
,Image(width)
, andImage(width, height)
. When invoked as constructors, + these must return a newHTMLImageElement
object (a newimg
element). If + the width argument is present, the new object'swidth
content attribute must be set to width. If + the height argument is also present, the new object'sheight
content attribute must be set to height. + The element's document must be the active document of the browsing + context of theWindow
object on which the interface object of the invoked + constructor is found.4.8.2 The
iframe +
- +
The nested browsing context's
Window
object's + cross-boundary event parent is the browsing context container. [DOM]If the attribute is not specified, or if the origin conditions listed above are not met, then the user agent should render the nested browsing context in a manner that is clearly distinguishable as a separate browsing context, and the @@ -28085,19 +27854,15 @@
4.8.7 The
-@@ -34692,7 +34457,7 @@Two constructors are provided for creating -
+HTMLAudioElement
objects (in addition to the factory - methods from DOM Core such ascreateElement()
):Audio()
andAudio(src)
. When invoked as constructors, - these must return a newHTMLAudioElement
object (a new -audio
element). The element must have itspreload
attribute set to the - literal value "auto
". If the src argument is present, the object created must have - itssrc
content attribute set to - the provided value, and the user agent must invoke the object's - resource selection - algorithm before returning. The element's document must be - the active document of the browsing - context of theWindow
object on which the - interface object of the invoked constructor is found.Two constructors are provided for creating
HTMLAudioElement
objects (in addition + to the factory methods from DOM such ascreateElement()
):Audio()
andAudio(src)
. When invoked as constructors, these must return a new +HTMLAudioElement
object (a newaudio
element). The element must have its +preload
attribute set to the literal value "auto
". If the src argument is present, + the object created must have itssrc
content attribute set to + the provided value, and the user agent must invoke the object's resource selection algorithm before returning. The + element's document must be the active document of the browsing context + of theWindow
object on which the interface object of the invoked constructor is + found.4.8.11 The
fallback content. (Focus has no effect on mouse interaction events.) - [DOMEVENTS] + [DOMEVENTS] The
canvas
element has two attributes to control the size of the coordinate space:width
andheight
. These attributes, when specified, must have @@ -52452,67 +52217,52 @@4.10.12 The
option
-@@ -69441,7 +69191,7 @@The
- -disabled
- IDL attribute must reflect the content attribute of the - same name. ThedefaultSelected
- IDL attribute must reflect theselected
content attribute.The
- -label
IDL - attribute, on getting, must return the element's label. On setting, the element's -label
content attribute must - be set to the new value.The
- -value
IDL - attribute, on getting, must return the element's value. On setting, the element's -value
content attribute must - be set to the new value.The
- -selected
- IDL attribute, on getting, must return true if the element's selectedness is true, and - false otherwise. On setting, it must set the element's selectedness to the new - value, and then cause the element to ask for a reset.The
- -index
IDL - attribute must return the element's index.The
- -text
IDL - attribute, on getting, must return the value of the -textContent
IDL attribute on the element, with leading and trailing - whitespace stripped, and with any sequences of two or more - space characters replaced by a - single U+0020 SPACE character. On setting, it must act as if the -textContent
IDL attribute on the element had been set - to the new value.The
- -form
IDL - attribute's behavior depends on whether theoption
- element is in aselect
element or not. If the -option
has aselect
element as its parent, - or has anoptgroup
element as its parent and that -optgroup
element has aselect
element as - its parent, then theform
IDL - attribute must return the same value as theform
IDL attribute on that -select
element. Otherwise, it must return null.Several constructors are provided for creating -
+HTMLOptionElement
objects (in addition to the factory - methods from DOM Core such ascreateElement()
):Option()
,Option(text)
,Option(text, value)
,Option(text, value, defaultSelected)
, andOption(text, value, defaultSelected, selected)
. When invoked as constructors, - these must return a newHTMLOptionElement
object (a new -option
element). If the text - argument is present, the new object must have as its only child a -Text
node whose data is the value of that argument. If - the value argument is present, the new object - must have avalue
attribute - set with the value of the argument as its value. If the defaultSelected argument is present and true, the new - object must have aselected
attribute set with no - value. If the selected argument is present and - true, the new object must have its selectedness set to true; - otherwise the fourth argument is absent or false, and the selectedness must be set - to false, even if the defaultSelected argument - is present and true. The element's document must be the active - document of the browsing context of the -Window
object on which the interface object of the - invoked constructor is found.The
+ +disabled
IDL attribute must + reflect the content attribute of the same name. ThedefaultSelected
IDL attribute must + reflect theselected
content attribute.The
+ +label
IDL attribute, on getting, must + return the element's label. On setting, the element's +label
content attribute must be set to the new value.The
+ +value
IDL attribute, on getting, must + return the element's value. On setting, the element's +value
content attribute must be set to the new value.The
+ +selected
IDL attribute, on getting, + must return true if the element's selectedness is + true, and false otherwise. On setting, it must set the element's selectedness to the new value, and then cause the + element to ask for a reset.The
+ +index
IDL attribute must return the + element's index.The
+ +text
IDL attribute, on getting, must return + the value of thetextContent
IDL attribute on the element, with leading and trailing whitespace stripped, and with any + sequences of two or more space characters replaced by a + single U+0020 SPACE character. On setting, it must act as if thetextContent
IDL + attribute on the element had been set to the new value.The
+ +form
IDL attribute's behavior depends on + whether theoption
element is in aselect
element or not. If the +option
has aselect
element as its parent, or has an +optgroup
element as its parent and thatoptgroup
element has a +select
element as its parent, then theform
IDL + attribute must return the same value as theform
IDL attribute + on thatselect
element. Otherwise, it must return null.Several constructors are provided for creating
HTMLOptionElement
objects (in + addition to the factory methods from DOM such ascreateElement()
):Option()
,Option(text)
,Option(text, value)
,Option(text, value, defaultSelected)
, andOption(text, value, defaultSelected, selected)
. When invoked as constructors, these must return a new +HTMLOptionElement
object (a newoption
element). If the text argument is present, the new object must have as its only child a +Text
node whose data is the value of that argument. If the value + argument is present, the new object must have avalue
+ attribute set with the value of the argument as its value. If the defaultSelected argument is present and true, the new object must have aselected
attribute set with no value. If the selected argument is present and true, the new object must have its selectedness set to true; otherwise the fourth argument + is absent or false, and the selectedness must be + set to false, even if the defaultSelected argument is present and true. The + element's document must be the active document of the browsing context + of theWindow
object on which the interface object of the invoked constructor is + found.6.6.3 Page load
When faced with displaying an XML file inline, user agents must first create a
+ recommendations, RFC 3023, DOM, and other relevant specifications. [XML] [XMLNS] [RFC3023] [DOM]Document
object, following the requirements of the XML and Namespaces in XML - recommendations, RFC 3023, DOM Core, and other relevant specifications. [XML] [XMLNS] [RFC3023] [DOMCORE]The actual HTTP headers and other metadata, not the headers as mutated or implied by the algorithms given in this specification, are the ones that must be used when determining the @@ -73421,6 +73171,7 @@
7.1.4.3 Generic task source tasks queued with the user interaction task source. [DOMEVENTS] + @@ -73599,104 +73350,86 @@
7.1.6.1 Event handlers< -
Many objects can have event handlers specified. These - act as non-capture event listeners for the object on which they are - specified. [DOMCORE]
+Many objects can have event handlers specified. These act as non-capture event + listeners for the object on which they are specified. [DOM]
-An event handler can either - have the value null or be set to a callback object. This is defined - using the
+EventHandler
callback interface type. Initially, event handlers must be set to - null.An event handler can either have the value null or be set + to a callback object. This is defined using the
EventHandler
callback interface type. + Initially, event handlers must be set to null.Event handlers are exposed in one of two ways.
-The first way, common to all event handlers, is as an event handler IDL - attribute.
+The first way, common to all event handlers, is as an event handler IDL attribute.
-The second way is as an event handler content attribute. Event handlers - on HTML elements and some of the event handlers on +
The second way is as an event handler content + attribute. Event handlers on HTML elements and some of the event handlers on
Window
objects are exposed in this way.--Event handler IDL attributes, on setting, must set the - corresponding event handler to their new value, and on - getting, must return whatever the current value of the corresponding +
Event handler IDL attributes, on setting, must set the corresponding event handler + to their new value, and on getting, must return whatever the current value of the corresponding event handler is (possibly null).
-If an event handler - IDL attribute exposes an event - handler of an object that doesn't exist, it must always +
If an event handler IDL attribute exposes an + event handler of an object that doesn't exist, it must always return null on getting and must do nothing on setting.
-This can happen in particular for event handler IDL attribute on -
body
elements that do not have corresponding +This can happen in particular for event + handler IDL attribute on
-body
elements that do not have correspondingWindow
objects.Certain event handler IDL attributes have additional - requirements, in particular the
onmessage
attribute of +Certain event handler IDL attributes have additional requirements, in particular + the
-onmessage
attribute ofMessagePort
objects.On getting, event handler IDL attributes must return - the value of their corresponding event handlers, except when the - value is an internal error - value, in which case the user agent must set the corresponding - event handler to null, and then throw an exception corresponding to - the error condition.
+On getting, event handler IDL attributes must return the value of their + corresponding event handlers, except when the value is an internal error value, in which case the user agent must set + the corresponding event handler to null, and then throw an exception corresponding to the error + condition.
Event handler content attributes, when specified, must - contain valid JavaScript code which, when parsed, would match the -
FunctionBody
production after automatic +Event handler content attributes, when specified, must contain valid JavaScript code + which, when parsed, would match the
FunctionBody
production after automatic semicolon insertion. [ECMA262]-When an event - handler content attribute is set, if the element is owned by - a
- -Document
that is in a browsing context, - and scripting is enabled for - that browsing context, the user agent must run the - following steps to create a script after setting the content - attribute to its new value:
- - -
Set the corresponding event - handler to null.
- +
Set up a script execution environment for - JavaScript.
When an event handler content attribute + is set, if the element is owned by a
+ +Document
that is in a browsing + context, and scripting is enabled for that + browsing context, the user agent must run the following steps to create a script after setting the content attribute to its new value:
- + +
Set the corresponding event handler to null.
- -
Set up a script execution environment for JavaScript.
- +
Let body be the event handler content - attribute's new value.
Let body be the event + handler content attribute's new value.
- -
If body is not parsable as - FunctionBody or if parsing detects an early error - then set the event handler content attribute to an - error as defined below, and abort these steps.
+If body is not parsable as FunctionBody or if parsing detects an + early error then set the event handler content attribute to an error as + defined below, and abort these steps.
-FunctionBody is defined in ECMAScript - edition 5 section 13 Function Definition. Early error is - defined in ECMAScript edition 5 section 16 Errors. [ECMA262]
+FunctionBody is defined in ECMAScript edition 5 section 13 Function + Definition. Early error is defined in ECMAScript edition 5 section 16 Errors. [ECMA262]
- -
@@ -73704,31 +73437,27 @@If body begins with a Directive Prologue - that contains a Use Strict Directive then let strict be true, otherwise let strict be false.
+If body begins with a Directive Prologue that contains a Use Strict + Directive then let strict be true, otherwise let strict + be false.
-The terms "Directive Prologue" and "Use Strict - Directive" are defined in ECMAScript edition 5 section 14.1 - Directive Prologues and the Use Strict Directive. [ECMA262]
+The terms "Directive Prologue" and "Use Strict Directive" are defined in + ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. [ECMA262]
7.1.6.1 Event handlers< currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11977#c4
- -
-->If strict is true, and anything in body is a
+SyntaxError
according to the - Strict Mode Restrictions, then set the event handler content - attribute to an error as defined below, and abort these - steps.If strict is true, and anything in body is a +
-SyntaxError
according to the Strict Mode Restrictions, then set the event + handler content attribute to an error as defined below, and abort these steps.The Strict Mode Restrictions are those listed in - ECMAScript edition 5 section 13.1 Strict Mode Restrictions. [ECMA262]
+The Strict Mode Restrictions are those listed in ECMAScript edition 5 section + 13.1 Strict Mode Restrictions. [ECMA262]
- -
-Using the script execution environment created above, create a - function object (as defined in ECMAScript edition 5 section 13.2 - Creating Function Objects), with:
+Using the script execution environment created above, create a function object (as defined in + ECMAScript edition 5 section 13.2 Creating Function Objects), with:
- Parameter list FormalParameterList
- -
- If the attribute is the
+onerror
attribute of the -Window
object
- If the attribute is the
onerror
attribute of + theWindow
object- Let the function have four arguments, named
@@ -73747,18 +73476,17 @@event
,source
,lineno
, andcolumn
.7.1.6.1 Event handlers<
- -
@@ -73766,35 +73494,29 @@
- Let Scope be the result of - NewObjectEnvironment(the element's
+Document
, the - global environment).
- Let Scope be the result of NewObjectEnvironment(the element's +
-Document
, the global environment).- If the element has a form owner, let Scope be the result of NewObjectEnvironment(the - element's form owner, Scope).
+- If the element has a form owner, let Scope be the result + of NewObjectEnvironment(the element's form owner, Scope).
-- Let Scope be the result of - NewObjectEnvironment(the element's object, Scope).
+- Let Scope be the result of NewObjectEnvironment(the element's object, + Scope).
-NewObjectEnvironment() is defined in ECMAScript - edition 5 section 10.2.2.3 NewObjectEnvironment (O, E). [ECMA262]
+NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3 + NewObjectEnvironment (O, E). [ECMA262]
7.1.6.1 Event handlers<
- The value of strict.
-Let this new function be the only entry in the script's - list of code entry-points.
+Let this new function be the only entry in the script's list of code + entry-points.
Set up the script's global object, the - script's browsing context, the script's - document, the script's referrer source, the - script's URL character encoding, and the - script's base URL from the script settings - determined from the node on which the attribute is being +
- -
Set up the script's global object, the script's browsing + context, the script's document, the script's referrer source, + the script's URL character encoding, and the script's base URL from + the script settings determined from the node on which the attribute is being set.
- - -
Set the corresponding event - handler to the aforementioned function.
When a user agent is required, by the steps above, to set - the event handler content attribute to an error, the user - agent must set the corresponding event - handler to an internal - error value representing the error condition, keeping track of - the URL of the resource where the event handler content attribute - was set, and the relevant line number inside that resource where the - error occurred.
- -When an event handler content attribute is removed, the user - agent must set the corresponding event - handler to null.
+- + +
Set the corresponding event handler to the + aforementioned function.
When a user agent is required, by the steps above, to set the event handler content + attribute to an error, the user agent must set the corresponding event handler to an internal error value + representing the error condition, keeping track of the URL of the resource where the + event handler content attribute was set, and + the relevant line number inside that resource where the error occurred.
+ +When an event handler content attribute is removed, the user agent must set the corresponding + event handler to null.
-When an event handler H of an element or object T - implementing the
- -EventTarget
interface is first set to - a non-null value, the user agent must append an event listener to the list of - event listeners - associated with T with type set to the - event handler event type corresponding to H, capture set to false, and listener - set to the event handler processing algorithm defined - below. [DOMCORE]The listener is emphatically not the - event handler itself. Every - event handler ends up registering the same listener, the - algorithm defined below, which takes care of invoking the right - callback, and processing the callback's return value.
- -This only happens the first time the event handler's value is set. Since - listeners are called in the order they were registered, the order of - event listeners for a particular event type will always be first the - event listeners registered with
+addEventListener()
- before the first time the event - handler was set to a non-null value, then the callback to - which it is currently set, if any, and finally the event listeners - registered withaddEventListener()
- after the first time the event - handler was set to a non-null value.When an event handler H of an element + or object T implementing the
+ +EventTarget
interface is first set + to a non-null value, the user agent must append an event + listener to the list of event listeners + associated with T with type set to the event handler event + type corresponding to H, capture set to false, and + listener set to the event handler processing algorithm defined below. [DOM]The listener is emphatically not the event handler itself. Every event handler ends up registering the same + listener, the algorithm defined below, which takes care of invoking the right callback, and + processing the callback's return value.
+ +This only happens the first time the event + handler's value is set. Since listeners are called in the order they were registered, the + order of event listeners for a particular event type will always be first the event listeners + registered with
addEventListener()
before + the first time the event handler was set to a non-null value, + then the callback to which it is currently set, if any, and finally the event listeners registered + withaddEventListener()
after the + first time the event handler was set to a non-null value.-@@ -16877,35 +16690,32 @@ c-end = "-->"This example demonstrates the order in which event listeners are - invoked. If the button in this example is clicked by the user, the - page will show four alerts, with the text "ONE", "TWO", "THREE", - and "FOUR" respectively.
+This example demonstrates the order in which event listeners are invoked. If the button in + this example is clicked by the user, the page will show four alerts, with the text "ONE", "TWO", + "THREE", and "FOUR" respectively.
<button id="test">Start Demo</button> <script> @@ -73862,15 +73577,13 @@7.1.6.1 Event handlers<
--The interfaces implemented by the event object do - not influence whether an event - handler is triggered or not.
+The interfaces implemented by the event object do not influence whether an event handler is triggered or not.
-The event handler processing algorithm for an - event handler H and an
+Event
object E is as follows:The event handler processing algorithm for an event + handler H and an
-Event
object E is as + follows:
- +
If H's value is null, then abort these - steps.
If H's value is null, then abort these steps.
- -
If H's value is an internal error value, then set the event handler to null and then @@ -73880,14 +73593,11 @@
7.1.6.1 Event handlers< handlers">event handler of the
Window
object of thatDocument
, and abort these steps.- +
Let callback be H's - value, the callback that the event - handler was last set to.
- -
Let callback be H's value, the callback that the + event handler was last set to.
- +
Invoke callback with one - argument, the value of which is the
Event
object E, with the callback this value set to - E'scurrentTarget
. Let the - return value be return value. [WEBIDL]Invoke callback with one argument, the value of which is the +
Event
object E, with the callback this value set to E'scurrentTarget
. Let the return value be return value. [WEBIDL]- @@ -73895,21 +73605,19 @@
7.1.6.1 Event handlers<
- If the event type is
-mouseover
- +
If return value is a boolean with the - value true, then cancel the event.
- -
If return value is a boolean with the value true, then cancel the + event.
- If the
+Event
object E is a -BeforeUnloadEvent
object- If the
-Event
object E is aBeforeUnloadEvent
+ object- +
If return value is a string, and the -
Event
object E'sreturnValue
- attribute's value is the empty string, then set thereturnValue
- attribute's value to return value.If return value is a string, and the
Event
object E'sreturnValue
+ attribute's value is the empty string, then set thereturnValue
attribute's value to return value.- Otherwise
-- +
If return value is a boolean with the - value false, then cancel the event.
- @@ -73917,16 +73625,14 @@
If return value is a boolean with the value false, then cancel the + event.
7.1.6.1 Event handlers<
The
+EventHandler
interface represents a callback - used for event handlers. It is represented in Web IDL as - follows:The
EventHandler
interface represents a callback used for event handlers. It is + represented in Web IDL as follows:[TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event); typedef EventHandlerNonNull? EventHandler;-In JavaScript, any
+Function
object - implements this interface.In JavaScript, any
Function
object implements this interface.@@ -73934,19 +73640,17 @@-7.1.6.1 Event handlers<
<body onload="alert(this)" onclick="alert(this)">-...leads to an alert saying "
+[object Window]
" when the document is loaded, - and an alert saying "[object HTMLBodyElement]
" whenever the user - clicks something in the page....leads to an alert saying "
[object Window]
" when the document is + loaded, and an alert saying "[object HTMLBodyElement]
" whenever the + user clicks something in the page.The return value of the function affects whether the - event is canceled or not: as described - above, if the return value is false, the event is canceled - (except for
+mouseover
events, - where the return value has to be true to cancel the event). With -beforeunload
events, the - value is instead used to determine the message to show the user.The return value of the function affects whether the event is canceled or not: + as described above, if the return value is false, the event is canceled + (except for
mouseover
events, where the return value has to + be true to cancel the event). Withbeforeunload
events, + the value is instead used to determine the message to show the user.For historical reasons, the
@@ -73960,12 +73664,10 @@onerror
handler has different arguments:7.1.6.1 Event handlers<
7.1.6.2 Event handlers on elements,
-Document
objects, andWindow
objectsThe following are the event handlers (and their - corresponding event handler - event types) that must be supported - by all HTML elements, as both content attributes and - IDL attributes, and on
+Document
andWindow
- objects, as IDL attributes.The following are the event handlers (and their corresponding event handler event types) that must be + supported by all HTML elements, as both content attributes and IDL attributes, and on +
Document
andWindow
objects, as IDL attributes.
Event handler Event handler event type onabort
abort
@@ -74122,12 +73824,15 @@7.1.6.3 Event firing
7.1.6.4 Events and the
-Window
objectWhen an event is dispatched at a DOM node in a -
+Document
in a browsing context, if the - event is not aload
event, the user - agent must act as if, for the purposes of event dispatching, the -Window
object is the parent of the -Document
object. [DOMCORE]When an event is dispatched at a DOM node in a
+ + @@ -82211,9 +81916,9 @@Document
in a browsing + context, if the event is not aload
event, the user agent + must act as if, for the purposes of event dispatching, + theWindow
object is the parent of theDocument
object. [DOM]9.3 APIs available to WorkerUtils implements WindowBase64; -
The DOM APIs — specifically, all the interfaces defind in the DOM Core specification - other than exceptions — must not be exposed if the - JavaScript global environment is a worker environment. [DOMCORE]
+The DOM APIs — specifically, all the interfaces defind in the DOM specification other + than exceptions — must not be exposed if the JavaScript + global environment is a worker environment. [DOMCORE]
9.3.1 Importing scripts and libraries
@@ -90625,7 +90330,7 @@12.2.5 Tree construction<
DOM mutation events must not fire for changes caused by the UA parsing the document. This includes the parsing of any content inserted using
-document.write()
anddocument.writeln()
calls. [DOMEVENTS]However, mutation observers do fire, as required by the DOM Core specification.
+However, mutation observers do fire, as required by the DOM specification.
Not all of the tag names mentioned below are conformant tag names in this specification; many are included to @@ -95322,42 +95027,37 @@
13.1 Writing XHTML docum
13.2 Parsing XHTML documents
-This section describes the relationship between XML and the DOM, - with a particular emphasis on how this interacts with HTML.
+This section describes the relationship between XML and the DOM, with a particular emphasis on + how this interacts with HTML.
-An XML parser, for the purposes of this specification, - is a construct that follows the rules given in the XML specification - to map a string of bytes or characters into a
+Document
- object.An XML parser, for the purposes of this specification, is a construct that follows + the rules given in the XML specification to map a string of bytes or characters into a +
-Document
object.An XML parser is either associated with a -
+Document
object when it is created, or creates one - implicitly.An XML parser is either associated with a
Document
object when it is + created, or creates one implicitly.This
+ into a document or has its attributes set, and the DOM specification's requirements regarding + mutation observers mean that mutation observers are fired (unlike mutation events). [XML] [XMLNS] [DOM] [DOMEVENTS] -Document
must then be populated with DOM nodes that represent the tree structure of the input passed to the parser, as defined by the XML specification, the Namespaces - in XML specification, and the DOM Core specification. DOM mutation events must not fire for the + in XML specification, and the DOM specification. DOM mutation events must not fire for the operations that the XML parser performs on theDocument
's tree, but the user agent must act as if elements and attributes were individually appended and set respectively so as to trigger rules in this specification regarding what happens when an element is inserted - into a document or has its attributes set, and the DOM Core specification's requirements regarding - mutation observers mean that mutation observers are fired (unlike mutation events). [XML] [XMLNS] [DOMCORE] [DOMEVENTS]Between the time an element's start tag is parsed and the time - either the element's end tag is parsed or the parser detects a - well-formedness error, the user agent must act as if the element was - in a stack of open elements.
+Between the time an element's start tag is parsed and the time either the element's end tag is + parsed or the parser detects a well-formedness error, the user agent must act as if the element + was in a stack of open elements.
-This is used by the
+object
element to - avoid instantiating plugins before theparam
element - children have been parsed.This is used by the
-object
element to avoid instantiating plugins + before theparam
element children have been parsed.This specification provides the following additional information - that user agents should use when retrieving an external entity: the - public identifiers given in the following list all correspond to the URL given by this - link. (This URL is a DTD containing the entity reference - declarations for the names listed in the named character - references section.)
+This specification provides the following additional information that user agents should use + when retrieving an external entity: the public identifiers given in the following list all + correspond to the URL given by this link. (This + URL is a DTD containing the entity reference declarations for the names listed in the named + character references section.)
-//W3C//DTD XHTML 1.0 Transitional//EN
- @@ -95539,23 +95239,19 @@
-//W3C//DTD XHTML 1.1//EN
13.4 Parsing XHTML fragm
- -
@@ -98676,7 +98372,7 @@If there is a context element, - feed the parser just created the string corresponding - to the start tag of that element, declaring all the namespace - prefixes that are in scope on that element in the DOM, as well as - declaring the default namespace (if any) that is in scope on that - element in the DOM.
+If there is a context element, feed the + parser just created the string corresponding to the start tag of that element, declaring + all the namespace prefixes that are in scope on that element in the DOM, as well as declaring + the default namespace (if any) that is in scope on that element in the DOM.
-A namespace prefix is in scope if the DOM Core
+lookupNamespaceURI()
method on the element would - return a non-null value for that prefix.A namespace prefix is in scope if the DOM
-lookupNamespaceURI()
method + on the element would return a non-null value for that prefix.The default namespace is the namespace for which the DOM Core -
+isDefaultNamespace()
method on the element - would return true.The default namespace is the namespace for which the DOM
-isDefaultNamespace()
method on the element would return true.If there is a context element, no
+DOCTYPE
is passed to the parser, and therefore no - external subset is referenced, and therefore no entities will be - recognized.If there is a context element, no +
DOCTYPE
is passed to the parser, and therefore no external subset is + referenced, and therefore no entities will be recognized.15.2 Non-conforming feat
event
onscript
elements- -
for
onscript
elements- +
Use DOM Events mechanisms to register event listeners. [DOMCORE]
Use DOM Events mechanisms to register event listeners. [DOM]
datapagesize
ontable
elements- @@ -103917,14 +103613,14 @@
Unnecessary. Omit it altogether.
References
- [DASH]
- Dynamic adaptive streaming over HTTP (DASH). ISO.
-- [DOMCORE]
-- Web DOM Core, A. van Kesteren. WHATWG.
+- [DOM]
+- DOM, A. van Kesteren, A. Gregor, Ms2ger. WHATWG.
- [DOMEVENTS]
- Document Object Model (DOM) Level 3 Events Specification, T. Leithead, J. Rossi, D. Schepers, B. Höhrmann, P. Le Hégaret, T. Pixley. W3C.
- [DOMPARSING]
-- DOM Parsing and Serialization, Ms2ger. html5.org.
+- DOM Parsing and Serialization, Ms2ger. WHATWG.
- [DOT]
- (Non-normative) The DOT Language. Graphviz.
@@ -103939,7 +103635,7 @@References
- (Non-normative) ECMAScript for XML (E4X) Specification. ECMA.
- [EDITING]
-- HTML Editing APIs, A. Gregor.
+- HTML Editing APIs, A. Gregor. W3C Editing APIs CG.
- [EUCKR]
- Hangul Unix Environment. Korea Industrial Standards Association. Ref. No. KS C 5861-1992.
diff --git a/index b/index index 2f7675500b3..e56925adfc3 100644 --- a/index +++ b/index @@ -387,8 +387,7 @@- 2.8.4 DOMElementMap
- 2.8.5 Transferable objects
- 2.8.6 Safe passing of structured data
-- 2.8.7 DOM feature strings
-- 2.8.8 Garbage collection
+- 2.8.7 Garbage collection
- 2.9 Namespaces
- 3 Semantics, structure, and APIs of HTML documents
@@ -1398,7 +1397,7 @@ relative to other specifications can be best summed up as follows: -
+
@@ -1679,23 +1678,21 @@
This section is non-normative.
-This specification is intended for authors of documents and - scripts that use the features defined in this specification, implementors of tools that operate on pages that use - the features defined in this specification, and individuals wishing - to establish the correctness of documents or implementations with - respect to the requirements of this specification.
+This specification is intended for authors of documents and scripts that use the features + defined in this specification, implementors of tools that operate on pages that + use the features defined in this specification, and individuals wishing to establish the + correctness of documents or implementations with respect to the requirements of this + specification.
-This document is probably not suited to readers who do not - already have at least a passing familiarity with Web technologies, - as in places it sacrifices clarity for precision, and brevity for - completeness. More approachable tutorials and authoring guides can - provide a gentler introduction to the topic.
+This document is probably not suited to readers who do not already have at least a passing + familiarity with Web technologies, as in places it sacrifices clarity for precision, and brevity + for completeness. More approachable tutorials and authoring guides can provide a gentler + introduction to the topic.
-In particular, familiarity with the basics of DOM Core and DOM - Events is necessary for a complete understanding of some of the more - technical parts of this specification. An understanding of Web IDL, - HTTP, XML, Unicode, character encodings, JavaScript, and CSS will - also be helpful in places but is not essential.
+In particular, familiarity with the basics of DOM is necessary for a complete understanding of + some of the more technical parts of this specification. An understanding of Web IDL, HTTP, XML, + Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not + essential.
1.5 Scope
@@ -3199,67 +3196,53 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d2.1 Terminology
-This specification refers to both HTML and XML attributes and IDL - attributes, often in the same context. When it is not clear which is - being referred to, they are referred to as content - attributes for HTML and XML attributes, and IDL - attributes for those defined on IDL interfaces. Similarly, the - term "properties" is used for both JavaScript object properties and - CSS properties. When these are ambiguous they are qualified as object properties and CSS - properties respectively.
- -Generally, when the specification states that a feature applies - to the HTML syntax or the XHTML syntax, it - also includes the other. When a feature specifically only applies to - one of the two languages, it is called out by explicitly stating - that it does not apply to the other format, as in "for HTML, - ... (this does not apply to XHTML)".
- -This specification uses the term document to - refer to any use of HTML, ranging from short static documents to - long essays or reports with rich multimedia, as well as to - fully-fledged interactive applications. The term is used to refer - both to
- -Document
objects and their descendant DOM - trees, and to serialized byte streams using the HTML syntax or XHTML syntax, depending on context.In the context of the DOM structures, the terms HTML document and XML - document are used as defined in the DOM Core specification, - and refer specifically to two different modes that -
- -Document
objects can find themselves in. [DOMCORE] (Such uses are always hyperlinked - to their definition.)In the context of byte streams, the term HTML document refers to - resources labeled as
- -text/html
, and the term XML - document refers to resources labeled with an XML MIME - type.The term XHTML document is used to refer to both -
- -Document
s in the XML - document mode that contains element nodes in the HTML - namespace, and byte streams labeled with an XML MIME - type that contain elements from the HTML - namespace, depending on context.For simplicity, terms such as shown, displayed, and visible might - sometimes be used when referring to the way a document is rendered - to the user. These terms are not meant to imply a visual medium; - they must be considered to apply to other media in equivalent - ways.
+This specification refers to both HTML and XML attributes and IDL attributes, often in the same + context. When it is not clear which is being referred to, they are referred to as content attributes for HTML and XML attributes, and IDL + attributes for those defined on IDL interfaces. Similarly, the term "properties" is used for + both JavaScript object properties and CSS properties. When these are ambiguous they are qualified + as object properties and CSS properties respectively.
+ +Generally, when the specification states that a feature applies to the HTML syntax + or the XHTML syntax, it also includes the other. When a feature specifically only + applies to one of the two languages, it is called out by explicitly stating that it does not apply + to the other format, as in "for HTML, ... (this does not apply to XHTML)".
+ +This specification uses the term document to refer to any use of HTML, + ranging from short static documents to long essays or reports with rich multimedia, as well as to + fully-fledged interactive applications. The term is used to refer both to
+ +Document
+ objects and their descendant DOM trees, and to serialized byte streams using the HTML syntax or XHTML syntax, depending + on context.In the context of the DOM structures, the terms HTML + document and XML document are used as defined in the DOM + specification, and refer specifically to two different modes that
+ +Document
objects + can find themselves in. [DOM] (Such uses are always hyperlinked to their + definition.)In the context of byte streams, the term HTML document refers to resources labeled as +
+ +text/html
, and the term XML document refers to resources labeled with an XML + MIME type.The term XHTML document is used to refer to both
+ +Document
s in the XML document mode that contains element nodes in the HTML + namespace, and byte streams labeled with an XML MIME type that contain + elements from the HTML namespace, depending on context.For simplicity, terms such as shown, displayed, and + visible might sometimes be used when referring to the way a document is + rendered to the user. These terms are not meant to imply a visual medium; they must be considered + to apply to other media in equivalent ways.
--When an algorithm B says to return to another algorithm A, it - implies that A called B. Upon returning to A, the implementation - must continue from where it left off in calling B.
+When an algorithm B says to return to another algorithm A, it implies that A called B. Upon + returning to A, the implementation must continue from where it left off in calling B.
The term "transparent black" refers to the color with red, green, - blue, and alpha channels all set to zero.
+The term "transparent black" refers to the color with red, green, blue, and alpha channels all + set to zero.
2.1.1 Resources
@@ -3409,27 +3392,23 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d2.1.4 Scripting
-The construction "a
Foo
object", where -Foo
is actually an interface, is sometimes used instead - of the more accurate "an object implementing the interface +The construction "a
-Foo
object", whereFoo
is actually an interface, + is sometimes used instead of the more accurate "an object implementing the interfaceFoo
".An IDL attribute is said to be getting when - its value is being retrieved (e.g. by author script), and is said to - be setting when a new value is assigned to - it.
+An IDL attribute is said to be getting when its value is being retrieved + (e.g. by author script), and is said to be setting when a new value is + assigned to it.
-If a DOM object is said to be live, then the - attributes and methods on that object must - operate on the actual underlying data, not a snapshot of the +
If a DOM object is said to be live, then the attributes and methods on that object + must operate on the actual underlying data, not a snapshot of the data.
In the contexts of events, the terms fire and dispatch are used as defined in the - DOM Core specification: firing an event means to create and - dispatch it, and dispatching an event means to follow the steps that propagate + DOM specification: firing an event means to create and dispatch it, and dispatching an event means to follow the steps that propagate the event through the tree. The term trusted event is used to refer to events whose
+ initialized to true. [DOM]isTrusted
attribute is - initialized to true. [DOMCORE]2.1.5 Plugins
@@ -4026,19 +4005,15 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d- -
The Document Object Model (DOM) is a representation — a - model — of a document and its content. The DOM is not just - an API; the conformance criteria of HTML implementations are - defined, in this specification, in terms of operations on the DOM. - [DOMCORE]
+The Document Object Model (DOM) is a representation — a model — of a document and + its content. The DOM is not just an API; the conformance criteria of HTML implementations are + defined, in this specification, in terms of operations on the DOM. [DOM]
-Implementations must support DOM Core and the events defined in - DOM Events, because this specification is defined in terms of the - DOM, and some of the features are defined as extensions to the DOM - Core interfaces. [DOMCORE] [DOMEVENTS]
+Implementations must support DOM and the events defined in DOM Events, because this + specification is defined in terms of the DOM, and some of the features are defined as extensions + to the DOM interfaces. [DOM] [DOMEVENTS]
-In particular, the following features are defined in the DOM - Core specification: [DOMCORE]
+In particular, the following features are defined in the DOM specification: [DOM]
Attr
interface- @@ -4084,6 +4059,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
Comment
interfaceisTrusted
attribute- The type of an event
- The concept of an event listener and the event listeners associated with an
+EventTarget
- The concept of a regular event parent and a cross-boundary event parent
- The encoding (herein the character encoding) and content type of a
Document
- The distinction between XML documents and HTML documents
@@ -4098,10 +4074,8 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d- The
MutationObserver
scripting environment concept- The invoke
-MutationObserver
objects algorithmThe term throw in this specification is used as - defined in the DOM Core specification. The following -
+DOMException
types are defined in the DOM Core - specification: [DOMCORE]The term throw in this specification is used as defined in the DOM specification. + The following
DOMException
types are defined in the DOM specification: [DOM]
IndexSizeError
- @@ -4124,20 +4098,15 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
HierarchyRequestError
TimeoutError
InvalidNodeTypeError
- -
DataCloneError
For example, to throw a -
+TimeoutError
exception, a user agent would - construct aDOMException
object whose type was the - string "TimeoutError
" (and whose code was - the number 23, for legacy reasons) and actually throw that object - as an exception.For example, to throw a
-TimeoutError
exception, a user + agent would construct aDOMException
object whose type was the string "TimeoutError
" (and whose code was the number 23, for legacy reasons) and + actually throw that object as an exception.The URL associated - with a
+Document
, as defined in the DOM Core - specification, is referred to in this specification as the - document's address.The URL associated with a
-Document
, as + defined in the DOM specification, is referred to in this specification as the document's + address.The following features are defined in the DOM Events - specification: [DOMEVENTS]
+The following features are defined in the DOM Events specification: [DOMEVENTS]
MouseEvent
interface- @@ -7682,7 +7651,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d affected by a base URL change.
MouseEventInit
dictionary typeThe following are base URL change steps, which run when an element is - affected by a base URL change (as defined by the DOM Core specification):
+ affected by a base URL change (as defined by the DOM specification):
- If the element creates a hyperlink
@@ -9126,8 +9095,8 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E.. node of reference. Otherwise, let parent be theselect
element on which theHTMLOptionsCollection
is rooted. -Act as if the DOM Core
insertBefore()
method - was invoked on the parent node, with element as the first +Act as if the DOM
insertBefore()
method was + invoked on the parent node, with element as the first argument and reference as the second argument.The
@@ -9572,31 +9541,10 @@ interface Transferable { }; -remove(index)
method must act according to the following algorithm:2.8.7 DOM feature strings
- -DOM3 Core defines mechanisms for checking for interface support, - and for obtaining implementations of interfaces, using feature - strings. [DOMCORE]
- -Authors are strongly discouraged from using these, as they are - notoriously unreliable and imprecise. Authors are encouraged to rely - on explicit feature testing or the graceful degradation behavior - intrinsic to some of the features in this specification.
-- - -For historical reasons, user agents should return the true value - when the
- -hasFeature(feature, version)
- method of theDOMImplementation
interface is invoked - with feature set to either "HTML
" or "XHTML
" and version set to either "1.0
" or - "2.0
".- -2.8.8 Garbage collection
+2.8.7 Garbage collection
There is an implied strong reference from any IDL attribute that returns a pre-existing object to that object.
@@ -9648,58 +9596,47 @@ interface Transferable { };3.1 Documents
-Every XML and HTML document in an HTML UA is represented by a -
+Document
object. [DOMCORE]Every XML and HTML document in an HTML UA is represented by a
-Document
object. [DOM]The document's address is an absolute URL - that is initially set when the
+Document
is created but - that can change during the lifetime of theDocument
, - for example when the user navigates to - a fragment identifier on the - page or when thepushState()
method is called - with a new URL.The document's address is an absolute URL that is initially set when + the
-Document
is created but that can change during the lifetime of the +Document
, for example when the user navigates to a + fragment identifier on the page or when thepushState()
method is called with a new URL.Interactive user agents typically expose - the document's address in their user interface. This is - the primary mechanism by which a user can tell if a site is +
Interactive user agents typically expose the document's address in + their user interface. This is the primary mechanism by which a user can tell if a site is attempting to impersonate another.
-When a
- -Document
is created by a script using thecreateDocument()
- orcreateHTMLDocument()
- APIs, the document's address is the same as the - document's address of the script's document, and - theDocument
is both ready for post-load - tasks and completely loaded immediately.Each
- -Document
object has a reload override - flag that is originally unset. The flag is set by thedocument.open()
anddocument.write()
methods in certain - situations. When the flag is set, theDocument
also has - a reload override buffer which is a Unicode string that - is used as the source of the document when it is reloaded.When the user agent is to perform an overridden - reload, it must act as follows:
- -
- - -
Let source be the value of the - browsing context's active document's - reload override buffer.
- +
Navigate the - browsing context to a resource whose source is source, with replacement enabled. When - the navigate algorithm creates a
Document
- object for this purpose, set thatDocument
's - reload override flag and set its reload override - buffer to source.When a
+ +Document
is created by a script using + thecreateDocument()
orcreateHTMLDocument()
APIs, the + document's address is the same as the document's address of the script's + document, and theDocument
is both ready for post-load tasks and + completely loaded immediately.Each
+ +Document
object has a reload override flag that is originally + unset. The flag is set by thedocument.open()
anddocument.write()
methods in certain situations. When the flag is + set, theDocument
also has a reload override buffer which is a Unicode + string that is used as the source of the document when it is reloaded.When the user agent is to perform an overridden reload, it must act as follows:
+ +
- + +
Let source be the value of the browsing context's + active document's reload override buffer.
Navigate the browsing context + to a resource whose source is source, with replacement enabled. + When the navigate algorithm creates a
Document
object for this purpose, + set thatDocument
's reload override flag and set its reload + override buffer to source.3.1.1 The
-Document
objectThe DOM Core specification defines a
+Document
interface, which this specification - extends significantly:The DOM specification defines a
Document
interface, which + this specification extends significantly:[OverrideBuiltins] partial /*sealed*/ interface Document { @@ -10997,28 +10934,24 @@ interface HTMLUnknownElement : 3.2.3.1 Theid
attribute -The
+id
attribute specifies its - element's unique identifier (ID). [DOMCORE]The
-id
attribute specifies its element's unique identifier (ID). [DOM]The value must be unique amongst all the IDs in the element's home - subtree and must contain at least one character. The value - must not contain any space - characters.
+The value must be unique amongst all the IDs in the element's + home subtree and must contain at least one character. The value must not contain any + space characters.
- + -An element's unique - identifier can be used for a variety of purposes, most - notably as a way to link to specific parts of a document using - fragment identifiers, as a way to target an element when scripting, - and as a way to style a specific element from CSS.
+An element's unique identifier can be used for a + variety of purposes, most notably as a way to link to specific parts of a document using fragment + identifiers, as a way to target an element when scripting, and as a way to style a specific + element from CSS.
@@ -11538,38 +11471,32 @@ Transport Protocol">HTTP</abbr> today.</p>The
- -script
element allows authors to include dynamic - script and data blocks in their documents. The element does not - represent content for the user.When used to include dynamic scripts, the scripts may either be - embedded inline or may be imported from an external file using the -
src
attribute. If the language - is not that described by "text/javascript
", - then thetype
attribute must - be present, as described below. Whatever language is used, the - contents of thescript
element must conform with the +The
+ +script
element allows authors to include dynamic script and data blocks in + their documents. The element does not represent content for the + user.When used to include dynamic scripts, the scripts may either be embedded inline or may be + imported from an external file using the
-src
attribute. If + the language is not that described by "text/javascript
", then thetype
attribute must be present, as described below. Whatever + language is used, the contents of thescript
element must conform with the requirements of that language's specification.When used to include data blocks (as opposed to scripts), the - data must be embedded inline, the format of the data must be given - using the
- -type
attribute, the -src
attribute must not be - specified, and the contents of thescript
element must - conform to the requirements defined for the format used.The
- -type
- attribute gives the language of the script or format of the data. If - the attribute is present, its value must be a valid MIME - type. Thecharset
parameter must not be - specified. The default, which is used if the attribute is absent, - is "text/javascript
".The
src
- attribute, if specified, gives the address of the external script - resource to use. The value of the attribute must be a valid - non-empty URL potentially surrounded by spaces identifying a - script resource of the type given by thetype
attribute, if the attribute is - present, or of the type "text/javascript
", if - the attribute is absent. A resource is a script resource of a given - type if that type identifies a scripting language and the resource +When used to include data blocks (as opposed to scripts), the data must be embedded inline, the + format of the data must be given using the
+ +type
attribute, + thesrc
attribute must not be specified, and the contents of + thescript
element must conform to the requirements defined for the format used.The
+ +type
attribute gives the language of the + script or format of the data. If the attribute is present, its value must be a valid MIME + type. Thecharset
parameter must not be specified. The default, which + is used if the attribute is absent, is "text/javascript
".The
-src
attribute, if specified, gives the + address of the external script resource to use. The value of the attribute must be a valid + non-empty URL potentially surrounded by spaces identifying a script resource of the type + given by thetype
attribute, if the attribute is present, or + of the type "text/javascript
", if the attribute is absent. A resource is a + script resource of a given type if that type identifies a scripting language and the resource conforms with the requirements of that language's specification.The
- -charset
- attribute gives the character encoding of the external script - resource. The attribute must not be specified if thesrc
attribute is not present. If the - attribute is set, its value must be a valid character encoding name, - must be an ASCII case-insensitive match for the - preferred MIME name for that encoding, and must match - the encoding given in thecharset
parameter of - the Content-Type metadata of the - external file, if any. [IANACHARSET]The
- -async
and -defer
attributes - are boolean attributes that - indicate how the script should be executed. Thedefer
andasync
attributes must not be - specified if thesrc
attribute - is not present.There are three possible modes that can be selected using these - attributes. If the
async
- attribute is present, then the script will be executed - asynchronously, as soon as it is available. If theasync
attribute is not present but - thedefer
attribute is - present, then the script is executed when the page has finished - parsing. If neither attribute is present, then the script is - fetched and executed immediately, before the user agent continues +The
+ +charset
attribute gives the character + encoding of the external script resource. The attribute must not be specified if thesrc
attribute is not present. If the attribute is set, its value + must be a valid character encoding name, must be an ASCII case-insensitive match for + the preferred MIME name for that encoding, and must match the encoding given in the +charset
parameter of the Content-Type + metadata of the external file, if any. [IANACHARSET]The
+ +async
anddefer
attributes are boolean attributes that indicate how the script should be executed. Thedefer
andasync
attributes + must not be specified if thesrc
attribute is not + present.There are three possible modes that can be selected using these attributes. If the
-async
attribute is present, then the script will be executed + asynchronously, as soon as it is available. If theasync
+ attribute is not present but thedefer
attribute is + present, then the script is executed when the page has finished parsing. If neither attribute is + present, then the script is fetched and executed immediately, before the user agent continues parsing the page.The exact processing details for these attributes - are, for mostly historical reasons, somewhat non-trivial, involving - a number of aspects of HTML. The implementation requirements are - therefore by necessity scattered throughout the specification. The - algorithms below (in this section) describe the core of this - processing, but these algorithms reference and are referenced by the - parsing rules for
- -script
start - and end tags in HTML, in foreign content, and in XML, the rules for thedocument.write()
method, the - handling of scripting, etc.The
+defer
attribute may be - specified even if theasync
- attribute is specified, to cause legacy Web browsers that only - supportdefer
(and notasync
) to fall back to thedefer
behavior instead of the - synchronous blocking behavior that is the default.The exact processing details for these attributes are, for mostly historical + reasons, somewhat non-trivial, involving a number of aspects of HTML. The implementation + requirements are therefore by necessity scattered throughout the specification. The algorithms + below (in this section) describe the core of this processing, but these algorithms reference and + are referenced by the parsing rules for
+ +script
start and end tags in HTML, in foreign content, + and in XML, the rules for thedocument.write()
method, the handling of scripting, etc.The
defer
attribute may be specified even if theasync
attribute is specified, to cause legacy Web browsers that + only supportdefer
(and notasync
) to fall back to thedefer
behavior instead of the synchronous blocking behavior that + is the default.The
@@ -16150,53 +16055,40 @@ c-end = "-->"crossorigin
attribute is a CORS settings attribute. It controls, for scripts that are obtained from other origins, whether error information will be exposed.-A
+script
element has several associated pieces of - state.A
+ +script
element has several associated pieces of state.The first is a flag indicating whether or not the script block has been "already + started". Initially,
+ +script
elements must have this flag unset (script blocks, + when created, are not "already started"). The cloning + steps forscript
elements must set the "already started" flag on the copy if + it is set on the element being cloned.The second is a flag indicating whether the element was "parser-inserted". + Initially,
+ +script
elements must have this flag unset. It is set by the HTML + parser and the XML parser onscript
elements they insert and + affects the processing of those elements.The third is a flag indicating whether the element will "force-async". Initially, +
+ +script
elements must have this flag set. It is unset by the HTML parser + and the XML parser onscript
elements they insert. In addition, whenever + ascript
element whose "force-async" flag is set has aasync
content attribute added, the element's + "force-async" flag must be unset.The fourth is a flag indicating whether or not the script block is "ready to be + parser-executed". Initially,
-script
elements must have this flag unset (script + blocks, when created, are not "ready to be parser-executed"). This flag is used only for elements + that are also "parser-inserted", to let the parser know when to execute the + script.The first is a flag indicating whether or not the script block - has been "already started". Initially, -
- -script
elements must have this flag unset (script - blocks, when created, are not "already started"). The cloning steps for -script
elements must set the "already started" flag on - the copy if it is set on the element being cloned.The second is a flag indicating whether the element was - "parser-inserted". Initially,
+script
- elements must have this flag unset. It is set by the HTML - parser and the XML parser onscript
- elements they insert and affects the processing of those - elements.The last few pieces of state are the script block's type, the + script block's character encoding, and the script block's fallback character + encoding. They are determined when the script is prepared, based on the attributes on + the element at that time, and the
-Document
of thescript
element.The third is a flag indicating whether the element will - "force-async". Initially,
- -script
elements - must have this flag set. It is unset by the HTML parser - and the XML parser onscript
elements they - insert. In addition, whenever ascript
element whose - "force-async" flag is set has aasync
content attribute added, the - element's "force-async" flag must be unset.The fourth is a flag indicating whether or not the script block is - "ready to be parser-executed". Initially, -
- -script
elements must have this flag unset (script - blocks, when created, are not "ready to be parser-executed"). This - flag is used only for elements that are also - "parser-inserted", to let the parser know when to - execute the script.The last few pieces of state are the script block's - type, the script block's character - encoding, and the script block's fallback - character encoding. They are determined when the script - is prepared, based on the attributes on the element at that time, - and the
- -Document
of thescript
- element.When a
+script
element that is not marked as being - "parser-inserted" experiences one of the events listed - in the following list, the user agent must synchronously prepare thescript
- element:When a
script
element that is not marked as being "parser-inserted" + experiences one of the events listed in the following list, the user agent must synchronously + prepare thescript
element:
- The
-script
element gets inserted into a document, at the time the node is inserted @@ -16208,33 +16100,28 @@ c-end = "-->"script
element, after anyscript
elements inserted at that time.- The
+script
element is in a -Document
and has asrc
attribute set where previously - the element had no such attribute.- The
-script
element is in aDocument
and has asrc
attribute set where previously the element had no such + attribute.To prepare a script, the user - agent must act as follows:
+To prepare a script, the user agent must act as + follows:
- -
If the
+script
element is marked as having - "already started", then the user agent must abort - these steps at this point. The script is not executed.If the
script
element is marked as having "already started", then + the user agent must abort these steps at this point. The script is not executed.- -
If the element has its "parser-inserted" flag set, - then set was-parser-inserted to true and unset - the element's "parser-inserted" flag. Otherwise, set - was-parser-inserted to false.
+If the element has its "parser-inserted" flag set, then set was-parser-inserted to true and unset the element's + "parser-inserted" flag. Otherwise, set was-parser-inserted to + false.
-This is done so that if parser-inserted -
+script
elements fail to run when the parser tries to - run them, e.g. because they are empty or specify an unsupported - scripting language, another script can later mutate them and cause - them to run again.This is done so that if parser-inserted
@@ -16242,33 +16129,28 @@ c-end = "-->"script
elements fail to run + when the parser tries to run them, e.g. because they are empty or specify an unsupported + scripting language, another script can later mutate them and cause them to run again.- -
If was-parser-inserted is true and the - element does not have an
+async
attribute, then set the - element's "force-async" flag to true.If was-parser-inserted is true and the element does not have an
-async
attribute, then set the element's + "force-async" flag to true.This is done so that if a parser-inserted -
+script
element fails to run when the parser tries to - run it, but it is later executed after a script dynamically - updates it, it will execute asynchronously even if the -async
attribute isn't - set.This is done so that if a parser-inserted
script
element fails to + run when the parser tries to run it, but it is later executed after a script dynamically updates + it, it will execute asynchronously even if theasync
+ attribute isn't set.- -
If the element has no
+src
- attribute, and its child nodes, if any, consist only of comment - nodes and emptyText
nodes, then the user agent must - abort these steps at this point. The script is not executed.If the element has no
src
attribute, and its child + nodes, if any, consist only of comment nodes and emptyText
nodes, then the user + agent must abort these steps at this point. The script is not executed.- -
@@ -16276,123 +16158,116 @@ c-end = "-->"If the element is not in a
+Document
, - then the user agent must abort these steps at this point. The - script is not executed.If the element is not in a
Document
, then the user agent must abort + these steps at this point. The script is not executed.If either:
-
- the
+script
element has atype
attribute and its value is - the empty string, or
- the
-script
element has atype
attribute + and its value is the empty string, or- the
+script
element has notype
attribute but it has alanguage
attribute and - that attribute's value is the empty string, or- the
-script
element has notype
attribute + but it has alanguage
attribute and that + attribute's value is the empty string, or- the
+script
element has neither atype
attribute nor alanguage
attribute, then- the
-script
element has neither atype
+ attribute nor alanguage
attribute, then...let the script block's type for this -
+script
element be "text/javascript
"....let the script block's type for this
-script
element be "text/javascript
".Otherwise, if the
+script
element has atype
attribute, let the - script block's type for thisscript
element be - the value of that attribute with any leading or trailing sequences - of space characters - removed.Otherwise, if the
-script
element has atype
attribute, let the script block's type for this +script
element be the value of that attribute with any leading or trailing + sequences of space characters removed.Otherwise, the element has a non-empty
+language
attribute; let - the script block's type for thisscript
- element be the concatenation of the string "text/
" followed by the value of thelanguage
attribute.Otherwise, the element has a non-empty
language
+ attribute; let the script block's type for thisscript
element be the + concatenation of the string "text/
" followed by the value of thelanguage
attribute.The
+ conforming, and is always ignored if there is alanguage
attribute is never - conforming, and is always ignored if there is atype
attribute present.type
+ attribute present.- -
If the user agent does not support the scripting - language given by the script block's type for - this
script
element, then the user agent must abort +If the user agent does not support the scripting language given by the + script block's type for this
script
element, then the user agent must abort these steps at this point. The script is not executed.- -
If was-parser-inserted is true, then flag - the element as "parser-inserted" again, and set the - element's "force-async" flag to false.
+If was-parser-inserted is true, then flag the element as + "parser-inserted" again, and set the element's "force-async" flag to + false.
- -
The user agent must set the element's "already - started" flag.
+The user agent must set the element's "already started" flag.
-The state of the element at this moment is later used to - determine the script source.
+The state of the element at this moment is later used to determine the script source.
- -
If the element is flagged as "parser-inserted", - but the element's
+Document
is not the -Document
of the parser that created the element, then - abort these steps.If the element is flagged as "parser-inserted", but the element's +
Document
is not theDocument
of the parser that created the element, + then abort these steps.- -
If scripting is - disabled for the
script
element, then the user - agent must abort these steps at this point. The script is not +If scripting is disabled for the
-script
+ element, then the user agent must abort these steps at this point. The script is not executed.The definition of scripting is disabled means - that, amongst others, the following scripts will not execute: - scripts in
+XMLHttpRequest
'sresponseXML
- documents, scripts inDOMParser
-created documents, - scripts in documents created byXSLTProcessor
'stransformToDocument
- feature, and scripts that are first inserted by a script into a -Document
that was created using thecreateDocument()
- API. [XHR] [DOMPARSING] [DOMCORE]The definition of scripting is disabled + means that, amongst others, the following scripts will not execute: scripts in +
XMLHttpRequest
'sresponseXML
+ documents, scripts inDOMParser
-created documents, scripts in documents created by +XSLTProcessor
'stransformToDocument
feature, and scripts + that are first inserted by a script into aDocument
that was created using the +createDocument()
API. [XHR] [DOMPARSING] [DOM]- -
If the
+script
element has anevent
attribute and afor
attribute, then run these - substeps:If the
-script
element has anevent
+ attribute and afor
attribute, then run these substeps:
- +
Let for be the value of the
for
attribute.
Let for be the value of the
for
+ attribute.- -
Let event be the value of the
event
attribute.- +
Strip leading and trailing whitespace from - event and for.
- -
Strip leading and trailing whitespace from event and + for.
- +
If for is not an ASCII - case-insensitive match for the string "
window
", then the user agent must abort these - steps at this point. The script is not executed.- -
If for is not an ASCII case-insensitive match for the + string "
window
", then the user agent must abort these steps at this + point. The script is not executed.- +
If event is not an ASCII - case-insensitive match for either the string "
onload
" or the string "onload()
", then the user agent must abort these - steps at this point. The script is not executed.If event is not an ASCII case-insensitive match for + either the string "
onload
" or the string "onload()
", then the user agent must abort these steps at this point. The script + is not executed.- -
If the
script
element has acharset
attribute, then let - the script block's character encoding for this +If the
-script
element has acharset
+ attribute, then let the script block's character encoding for thisscript
element be the encoding given by thecharset
attribute.Otherwise, let the script block's fallback character - encoding for this
+script
element be the same as - the encoding of the - document itself.Otherwise, let the script block's fallback character encoding for this +
script
element be the same as the + encoding of the document itself.Only one of these two pieces of state is set.
@@ -16400,8 +16275,8 @@ c-end = "-->"- -
- +If the element has a
+src
- content attribute, run these substeps:If the element has a
src
content attribute, run these + substeps:
- @@ -16446,187 +16321,152 @@ c-end = "-->"
Let src be the value of the element's
src
attribute.- -
-Then, the first of the following options that describes the - situation must be followed:
+Then, the first of the following options that describes the situation must be followed:
-
- If the element has a
+src
attribute, and the element has - adefer
attribute, and the - element has been flagged as "parser-inserted", and - the element does not have anasync
attribute
- If the element has a
src
+ attribute, and the element has adefer
attribute, and + the element has been flagged as "parser-inserted", and the element does not have + anasync
attribute- -
-The element must be added to the end of the list of - scripts that will execute when the document has finished - parsing associated with the
+Document
of the - parser that created the element.The element must be added to the end of the list of scripts that will execute when the + document has finished parsing associated with the
-Document
of the parser + that created the element.The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must set the element's - "ready to be parser-executed" flag. The parser will - handle executing the script.
+The task that the networking task source + places on the task queue once the fetching algorithm + has completed must set the element's "ready to be parser-executed" flag. The + parser will handle executing the script.
- If the element has a -
+src
attribute, and the - element has been flagged as "parser-inserted", and - the element does not have anasync
attribute- If the element has a
src
attribute, and the element has been flagged as + "parser-inserted", and the element does not have anasync
attribute- -
-The element is the pending parsing-blocking - script of the
+Document
of the parser that - created the element. (There can only be one such script per -Document
at a time.)The element is the pending parsing-blocking script of the +
-Document
of the parser that created the element. (There can only be one such + script perDocument
at a time.)The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must set the element's - "ready to be parser-executed" flag. The parser will - handle executing the script.
+The task that the networking task source + places on the task queue once the fetching algorithm + has completed must set the element's "ready to be parser-executed" flag. The + parser will handle executing the script.
- If the element does not - have a
+src
attribute, and - the element has been flagged as "parser-inserted", - and either the parser that created thescript
is an - XML parser or it's an HTML parser whose - script nesting level is not greater than one, and the -Document
of the HTML parser or - XML parser that created thescript
- element has a style sheet that is blocking - scripts- If the element does not have a
src
attribute, and the element has been flagged as + "parser-inserted", and either the parser that created thescript
is + an XML parser or it's an HTML parser whose script nesting + level is not greater than one, and theDocument
of the HTML + parser or XML parser that created thescript
element has + a style sheet that is blocking scripts- -
-The element is the pending parsing-blocking - script of the
+Document
of the parser that - created the element. (There can only be one such script per -Document
at a time.)The element is the pending parsing-blocking script of the +
-Document
of the parser that created the element. (There can only be one such + script perDocument
at a time.)Set the element's "ready to be parser-executed" - flag. The parser will handle executing the script.
+Set the element's "ready to be parser-executed" flag. The parser will handle + executing the script.
- If the element has a
+src
attribute, does not have an -async
attribute, and does - not have the "force-async" flag set- If the element has a
src
attribute, does not have anasync
attribute, and does not have the + "force-async" flag set- -
-The element must be added to the end of the list of - scripts that will execute in order as soon as possible - associated with the
- -Document
of the -script
element at the time the prepare a - script algorithm started.The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must run the following steps:
- -
- - -
If the element is not now the first element in the - list of scripts that will execute in order as soon as - possible to which it was added above, then mark the - element as ready but abort these steps without executing the - script yet.
Execution: Execute the script block - corresponding to the first script element in this list of - scripts that will execute in order as soon as +
The element must be added to the end of the list of scripts that will execute in order + as soon as possible associated with the
+ +Document
of thescript
+ element at the time the prepare a script algorithm started.The task that the networking task source + places on the task queue once the fetching algorithm + has completed must run the following steps:
+ +
- + +
If the element is not now the first element in the list of scripts that will + execute in order as soon as possible to which it was added above, then mark the + element as ready but abort these steps without executing the script yet.
- -
Execution: Execute the script block corresponding to the first + script element in this list of scripts that will execute in order as soon as possible.
- +
Remove the first element from this list of scripts - that will execute in order as soon as possible.
- -
Remove the first element from this list of scripts that will execute in order as + soon as possible.
If this list of scripts that will execute in order - as soon as possible is still not empty and the first - entry has already been marked as ready, then jump back to the +
If this list of scripts that will execute in order as soon as possible is + still not empty and the first entry has already been marked as ready, then jump back to the step labeled execution.
- If the element has a
+src
attribute- If the element has a
src
+ attribute- -
The element must be added to the set of scripts that - will execute as soon as possible of the -
+Document
of thescript
element at the - time the prepare a script algorithm started.The element must be added to the set of scripts that will execute as soon as + possible of the
-Document
of thescript
element at the time the + prepare a script algorithm started.The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must execute the script - block and then remove the element from the set of - scripts that will execute as soon as possible.
+The task that the networking task source + places on the task queue once the fetching algorithm + has completed must execute the script block and then remove the element from the + set of scripts that will execute as soon as possible.
- Otherwise
-- The user agent must immediately execute the script - block, even if other scripts are already executing.
+- The user agent must immediately execute the script block, even if other + scripts are already executing.
Fetching an external script must delay the load - event of the element's document until the task that is queued by the networking task source once - the resource has been fetched (defined - above) has been run.
- -The pending parsing-blocking script of a -
- -Document
is used by theDocument
's - parser(s).If a
- - - -script
element that blocks a - parser gets moved to anotherDocument
before it would - normally have stopped blocking that parser, it nonetheless continues - blocking that parser until the condition that causes it to be - blocking the parser no longer applies (e.g. if the script is a - pending parsing-blocking script because there was - a style sheet that is blocking scripts when it was - parsed, but then the script is moved to another -Document
before the style sheet loads, the script still - blocks the parser until the style sheets are all loaded, at which - time the script executes and the parser is unblocked).When the user agent is required to execute a script block, it must run the following - steps:
+Fetching an external script must delay the load event of the element's document + until the task that is queued + by the networking task source once the resource has been fetched (defined above) has been run.
+ +The pending parsing-blocking script of a
+ +Document
is used by the +Document
's parser(s).If a
+ + + +script
element that blocks a parser gets moved to another +Document
before it would normally have stopped blocking that parser, it nonetheless + continues blocking that parser until the condition that causes it to be blocking the parser no + longer applies (e.g. if the script is a pending parsing-blocking script because there + was a style sheet that is blocking scripts when it was parsed, but then the script is + moved to anotherDocument
before the style sheet loads, the script still blocks the + parser until the style sheets are all loaded, at which time the script executes and the parser is + unblocked).When the user agent is required to execute a script + block, it must run the following steps:
- -
@@ -16634,58 +16474,48 @@ c-end = "-->"If the element is flagged as "parser-inserted", - but the element's
+Document
is not the -Document
of the parser that created the element, then - abort these steps.If the element is flagged as "parser-inserted", but the element's +
Document
is not theDocument
of the parser that created the element, + then abort these steps.Jump to the appropriate set of steps from the list below:
-
- If the load resulted in an error (for example a DNS error, or - an HTTP 404 error)
+
- If the load resulted in an error (for example a DNS error, or an HTTP 404 error)
-- +
Executing the script block must just consist of firing a simple event named -
error
at the element.Executing the script block must just consist of firing + a simple event named
error
at the element.- If the load was successful
- -
Executing the script block must consist of running the - following steps. For the purposes of these steps, the script is - considered to be from an external file if, while the - prepare a script algorithm above was running for - this script, the
+script
element had asrc
attribute specified.Executing the script block must consist of running the following steps. For the purposes of + these steps, the script is considered to be from an external file if, while the + prepare a script algorithm above was running for this script, the +
script
element had asrc
attribute + specified.
- -
Initialize the script block's source - as follows:
+Initialize the script block's source as follows:
-
- If the script is from an external file and the - script block's type is a text-based language
+
- If the script is from an external file and the script block's type is a + text-based language
- -
The contents of that file, interpreted as a Unicode - string, are the script source.
+The contents of that file, interpreted as a Unicode string, are the script source.
-To obtain the Unicode string, the user agent run the - following steps:
+To obtain the Unicode string, the user agent run the following steps:
-
- +
If the resource's Content - Type metadata, if any, specifies a character - encoding, and the user agent supports that encoding, then - let character encoding be that - encoding, and jump to the bottom step in this series of - steps.
- -
If the resource's Content Type metadata, if any, + specifies a character encoding, and the user agent supports that encoding, then let character encoding be that encoding, and jump to the bottom step in this + series of steps.
- +
If the algorithm above set the script block's - character encoding, then let character - encoding be that encoding, and jump to the bottom - step in this series of steps.
- -
If the algorithm above set the script block's character encoding, then + let character encoding be that encoding, and jump to the bottom step + in this series of steps.
For each of the rows in the following table, - starting with the first one and going down, if the file has - as many or more bytes available than the number of bytes in - the first column, and the first bytes of the file match the - bytes given in the first column, then set character encoding to the encoding given in - the cell in the second column of that row, and jump to the - bottom step in this series of steps:
+For each of the rows in the following table, starting with the first one and going + down, if the file has as many or more bytes available than the number of bytes in the + first column, and the first bytes of the file match the bytes given in the first column, + then set character encoding to the encoding given in the cell in the + second column of that row, and jump to the bottom step in this series of steps:
Bytes in Hexadecimal @@ -16708,53 +16538,47 @@ c-end = "-->" DD 73 66 73 UTF-EBCDIC --> - This step looks for Unicode Byte Order - Marks (BOMs).
+This step looks for Unicode Byte Order Marks (BOMs).
-- +
Let character encoding be - the script block's fallback character - encoding.
- -
Let character encoding be the script block's fallback + character encoding.
- -
Convert the file to Unicode using character - encoding, following the rules for doing so given by - the specification for the script block's +
- -
Convert the file to Unicode using character encoding, following the + rules for doing so given by the specification for the script block's type.
- If the script is from an external file and the - script block's type is an XML-based language
+- If the script is from an external file and the script block's type is an + XML-based language
- -
-The external file is the script source. When it is later - executed, it must be interpreted in a manner consistent with - the specification defining the language given by the - script block's type.
+The external file is the script source. When it is later executed, it must be + interpreted in a manner consistent with the specification defining the language given by + the script block's type.
- If the script is inline and the script block's - type is a text-based language
+- If the script is inline and the script block's type is a text-based + language
- -
-The value of the
+text
IDL attribute at the - time the element's "already started" flag was - last set is the script source.The value of the
text
IDL attribute at the time + the element's "already started" flag was last set is the script source.- If the script is inline and the script block's - type is an XML-based language
+- If the script is inline and the script block's type is an XML-based + language
- -
@@ -16762,9 +16586,8 @@ c-end = "-->"The child nodes of the
+script
element at the - time the element's "already started" flag was - last set are the script source.The child nodes of the
script
element at the time the element's + "already started" flag was last set are the script source.- -
Fire a simple event named
+beforescriptexecute
- that bubbles and is cancelable at thescript
- element.Fire a simple event named
beforescriptexecute
that bubbles and is cancelable + at thescript
element.If the event is canceled, then abort these steps.
@@ -16773,8 +16596,8 @@ c-end = "-->"- @@ -16796,18 +16619,16 @@ c-end = "-->"
If the script is from an external file, then increment the - ignore-destructive-writes counter of the -
script
element'sDocument
. Let neutralized doc be that + ignore-destructive-writes counter of thescript
element's +Document
. Let neutralized doc be thatDocument
.- -
@@ -16820,28 +16641,24 @@ c-end = "-->"Create a - script from the
+script
element node, using - the script block's source, the URL - from which the script was obtained, and the script - block's type.Create a script from the +
script
element node, using the script block's source, the + URL from which the script was obtained, and the script block's + type.If the script came from a resource that was fetched in the steps above, and the resource was CORS-cross-origin, then pass the muted errors flag to the create a script from a node algorithm.
-This is where the script is compiled and - actually executed.
+This is where the script is compiled and actually executed.
- -
Decrement the ignore-destructive-writes - counter of neutralized doc, if it - was incremented in the earlier step.
+Decrement the ignore-destructive-writes counter of neutralized + doc, if it was incremented in the earlier step.
- -
Fire a simple event named
+afterscriptexecute
- that bubbles (but is not cancelable) at the -script
element.Fire a simple event named
afterscriptexecute
that bubbles (but is not + cancelable) at thescript
element.- -
@@ -16850,25 +16667,21 @@ c-end = "-->"If the script is from an external file, fire a simple - event named
+load
at the -script
element.If the script is from an external file, fire a simple event named
-load
at thescript
element.Otherwise, the script is internal; queue a - task to fire a simple event named
load
at thescript
+Otherwise, the script is internal; queue a task to fire a simple + event named
load
at thescript
element.The IDL attributes
+src
,type
,charset
,defer
, each must - reflect the respective content attributes of the same - name.The IDL attributes
src
,type
,charset
,defer
, each must reflect the respective + content attributes of the same name.The
-crossOrigin
IDL attribute must reflect thecrossorigin
content attribute.The
+async
IDL - attribute controls whether the element will execute asynchronously - or not. If the element's "force-async" flag is set, - then, on getting, theasync
- IDL attribute must return true, and on setting, the - "force-async" flag must first be unset, and then the - content attribute must be removed if the IDL attribute's new value - is false, and must be set to the empty string if the IDL attribute's - new value is true. If the element's "force-async" flag - is not set, the IDL attribute must reflect the -async
content attribute.The
async
IDL attribute controls whether the + element will execute asynchronously or not. If the element's "force-async" flag is + set, then, on getting, theasync
IDL attribute must return + true, and on setting, the "force-async" flag must first be unset, and then the + content attribute must be removed if the IDL attribute's new value is false, and must be set to + the empty string if the IDL attribute's new value is true. If the element's + "force-async" flag is not set, the IDL attribute must reflect + theasync
content attribute.- -
Returns the contents of the element, ignoring child nodes that - aren't
+Text
nodes.Returns the contents of the element, ignoring child nodes that aren't
-Text
+ nodes.Can be set, to replace the element's children with the given - value.
+Can be set, to replace the element's children with the given value.
-The IDL attribute
+ concatenation of the contents of all thetext
must return a - concatenation of the contents of all theText
nodes - that are children of thescript
element (ignoring any - other nodes such as comments or elements), in tree order. On - setting, it must act the same way as thetextContent
- IDL attribute.Text
nodes that are children of the +script
element (ignoring any other nodes such as comments or elements), in tree + order. On setting, it must act the same way as thetextContent
IDL attribute.When inserted using the
+document.write()
method, -script
elements execute (typically synchronously), but - when inserted usinginnerHTML
andouterHTML
attributes, they do not - execute at all.When inserted using the
document.write()
+ method,script
elements execute (typically synchronously), but when inserted using +innerHTML
andouterHTML
+ attributes, they do not execute at all.-In this example, two
+script
elements are used. One - embeds an external script, and the other includes some data.In this example, two
script
elements are used. One embeds an external script, and + the other includes some data.<script src="game-engine.js"></script> <script type="text/x-game-map"> @@ -16915,22 +16725,19 @@ o............A....e .A..AAA...AAAAA...e </script>-The data in this case might be used by the script to generate - the map of a video game. The data doesn't have to be used that way, - though; maybe the map data is actually embedded in other parts of - the page's markup, and the data block here is just used by the - site's search engine to help users who are looking for particular - features in their game maps.
+The data in this case might be used by the script to generate the map of a video game. The + data doesn't have to be used that way, though; maybe the map data is actually embedded in other + parts of the page's markup, and the data block here is just used by the site's search engine to + help users who are looking for particular features in their game maps.
-The following sample shows how a script element can be used to - define a function that is then used by other parts of the - document. It also shows how a
+script
element can be - used to invoke script while the document is being parsed, in this - case to initialize the form's output.The following sample shows how a script element can be used to define a function that is then + used by other parts of the document. It also shows how a
script
element can be used + to invoke script while the document is being parsed, in this case to initialize the form's + output.<script> function calculate(form) { @@ -22502,15 +22309,13 @@ wormhole connection.</mark></p>- Global attributes
- DOM interface:
- Uses
-HTMLElement
.The
+ruby
element allows one or more spans of - phrasing content to be marked with ruby annotations. Ruby - annotations are short runs of text presented alongside base text, - primarily used in East Asian typography as a guide for - pronunciation or to include other annotations. In Japanese, this - form of typography is also known as furigana.The
-ruby
element allows one or more spans of phrasing content to be marked with + ruby annotations. Ruby annotations are short runs of text presented alongside base text, primarily + used in East Asian typography as a guide for pronunciation or to include other annotations. In + Japanese, this form of typography is also known as furigana.The content model of
+ruby
elements consists of one - or more of the following sequences:The content model of
ruby
elements consists of one or more of the following + sequences:
- One or the other of the following:
- Phrasing content, but with no
ruby
elements and with noruby
element descendants @@ -22518,16 +22323,14 @@ wormhole connection.</mark></p>- One or the other of the following:
The
+ruby
andrt
elements can be used - for a variety of kinds of annotations, including in particular those - described below. For more details on Japanese Ruby in particular, - and how to render Ruby for Japanese, see Requirements for - Japanese Text Layout. [JLREQ]The
-ruby
andrt
elements can be used for a variety of kinds of + annotations, including in particular those described below. For more details on Japanese Ruby in + particular, and how to render Ruby for Japanese, see Requirements for Japanese Text + Layout. [JLREQ]At the time of writing, CSS does not yet provide a - way to fully control the rendering of the HTML
+ruby
- element. It is hoped that CSS will be extended to support the styles - described below in due course.At the time of writing, CSS does not yet provide a way to fully control the + rendering of the HTML
@@ -22556,11 +22359,10 @@ wormhole connection.</mark></p>ruby
element. It is hoped that CSS will be extended to support + the styles described below in due course.- -
This is similar to the previous case: each ideographic - character in the compound word (the base text) has its reading - given in hiragana or katakana characters (the ruby annotation). - The difference is that the base text segments form a compound word - rather than being separate from each other. +
This is similar to the previous case: each ideographic character in the compound word (the + base text) has its reading given in hiragana or katakana characters (the ruby annotation). The + difference is that the base text segments form a compound word rather than being separate from + each other.
<ruby>B<rt>annotation</rt>B<rt>annotation</ruby>@@ -22581,11 +22383,9 @@ wormhole connection.</mark></p>- -
@@ -22607,9 +22406,8 @@ wormhole connection.</mark></p>This is semantically identical to the previous case (each - individual ideographic character in the base compound word has its - reading given in an annotation in hiragana or katakana - characters), but the rendering is the more complicated Jukugo Ruby - rendering. +
This is semantically identical to the previous case (each individual ideographic character in + the base compound word has its reading given in an annotation in hiragana or katakana + characters), but the rendering is the more complicated Jukugo Ruby rendering.
-This is the same example as above for mono-ruby for compound words. The different rendering is expected to be achieved using different styling (e.g. in CSS), and is not shown here.
@@ -22596,9 +22396,8 @@ wormhole connection.</mark></p> -->For more details on Jukugo - Ruby rendering, see Appendix F in the Requirements for - Japanese Text Layout. [JLREQ]
+For more details on Jukugo Ruby rendering, see + Appendix F in the Requirements for Japanese Text Layout. [JLREQ]
- -
The annotation describes the meaning of the base text, rather - than (or in addition to) the pronunciation. As such, both the base - text and the annotation can be multiple characters long. +
The annotation describes the meaning of the base text, rather than (or in addition to) the + pronunciation. As such, both the base text and the annotation can be multiple characters long.
<ruby>BASE<rt>annotation</ruby>@@ -22632,11 +22430,10 @@ wormhole connection.</mark></p>- -
A phonetic reading that corresponds to multiple base - characters, because a one-to-one mapping would be difficult. (In - English, the words "Colonel" and "Lieutenant" are examples of - words where a direct mapping of pronunciation to individual - letters is, in some dialects, rather unclear.) +
A phonetic reading that corresponds to multiple base characters, because a one-to-one mapping + would be difficult. (In English, the words "Colonel" and "Lieutenant" are examples of words + where a direct mapping of pronunciation to individual letters is, in some dialects, rather + unclear.)
In this example, the name of a species of flowers has a phonetic reading provided using group ruby: @@ -22674,48 +22471,38 @@ wormhole connection.</mark></p> -
Within a
- -ruby
element that does not have a -ruby
element ancestor, content is segmented and - segments are placed into three categories: base text segments, - annotation segments, and ignored segments. Ignored segments do not - form part of the document's semantics (they consist of some - inter-element whitespace andrp
elements, - the latter of which are used for legacy user agents that do not - support ruby at all). Base text segments can overlap (with a limit - of two segments overlapping any one position in the DOM, and with - any segment having an earlier start point than an overlapping - segment also having an equal or later end point, and any segment - have a later end point than an overlapping segment also having an - equal or earlier start point). Annotation - segments correspond tort
elements. Each annotation - segment can be associated with a base text segment, and each base - text segment can have annotation segments associated with it. (In a - conforming document, each base text segment is associated with at - least one annotation segment, and each annotation segment is - associated with one base text segment.) Aruby
element - represents the union of the segments of base text it - contains, along with the mapping from those base text segments to - annotation segments. Segments are described in terms of DOM ranges; - annotation segment ranges always consist of exactly one element. [DOMCORE]At any particular time, the segmentation and categorisation of - content of a
- -ruby
element is the result that would be - obtained from running the following algorithm:
- - -
Let base text segments be an empty list - of base text segments, each potentially with a list of base text - subsegments.
- - -
Let annotation segments be an empty list - of annotation segments, each potentially being associated with a - base text segment or subsegment.
- - -
Let root be the
ruby
- element for which the algorithm is being run.- +
If root has a
ruby
element - ancestor, then jump to the step labeled end.Within a
+ +ruby
element that does not have aruby
element ancestor, + content is segmented and segments are placed into three categories: base text segments, annotation + segments, and ignored segments. Ignored segments do not form part of the document's semantics + (they consist of some inter-element whitespace andrp
elements, the + latter of which are used for legacy user agents that do not support ruby at all). Base text + segments can overlap (with a limit of two segments overlapping any one position in the DOM, and + with any segment having an earlier start point than an overlapping segment also having an equal or + later end point, and any segment have a later end point than an overlapping segment also having an + equal or earlier start point). Annotation segments correspond tort
elements. Each annotation + segment can be associated with a base text segment, and each base text segment can have annotation + segments associated with it. (In a conforming document, each base text segment is associated with + at least one annotation segment, and each annotation segment is associated with one base text + segment.) Aruby
element represents the union of the segments of base + text it contains, along with the mapping from those base text segments to annotation segments. + Segments are described in terms of DOM ranges; annotation segment ranges always consist of exactly + one element. [DOM]At any particular time, the segmentation and categorisation of content of a
+ +ruby
+ element is the result that would be obtained from running the following algorithm:
- + +
Let base text segments be an empty list of base text segments, each + potentially with a list of base text subsegments.
- + +
Let annotation segments be an empty list of annotation segments, each + potentially being associated with a base text segment or subsegment.
- + +
Let root be the
ruby
element for which the algorithm is + being run.If root has a
ruby
element ancestor, then jump to the + step labeled end.- @@ -22728,165 +22515,153 @@ wormhole connection.</mark></p>
Let current parent be root.
- - + -
Let current base text be null.
Start mode: If index is equal to - or greater than the number of child nodes in current - parent, then jump to the step labeled end mode.
+Start mode: If index is equal to or greater than the number of + child nodes in current parent, then jump to the step labeled end + mode.
-If the indexth node in current parent is an
rt
or -rp
element, jump to the step labeled annotation +- - +
If the indexth node in current parent is an +
rt
orrp
element, jump to the step labeled annotation mode.- -
Set start index to the value of index.
- +
Base mode: If the indexth node in - current parent is a
ruby
element, - and if current parent is the same element as - root, then push a ruby level and - then jump to the step labeled start mode.- -
Base mode: If the indexth node in current + parent is a
ruby
element, and if current parent is the + same element as root, then push a ruby level and then jump to + the step labeled start mode.- +
If the indexth node in current parent is an
rt
or -rp
element, then set the current base - text and then jump to the step labeled annotation - mode.If the indexth node in current parent is an +
rt
orrp
element, then set the current base text and then + jump to the step labeled annotation mode.- -
Increment index by one.
- +
Base mode post-increment: If index is equal to or greater than the number of - child nodes in current parent, then jump to the - step labeled end mode.
Base mode post-increment: If index is equal to or greater than + the number of child nodes in current parent, then jump to the step labeled + end mode.
- -
Jump back to the step labeled base mode.
- +
Annotation mode: If the indexth - node in current parent is an
rt
- element, then push a ruby annotation and jump to the - step labeled annotation mode increment.- -
Annotation mode: If the indexth node in current + parent is an
rt
element, then push a ruby annotation and jump to + the step labeled annotation mode increment.- +
If the indexth node in current parent is an
rp
element, jump - to the step labeled annotation mode increment.- -
If the indexth node in current parent is an +
rp
element, jump to the step labeled annotation mode increment.- +
If the indexth node in current parent is not a
Text
node, or - is aText
node that is not inter-element - whitespace, then jump to the step labeled base - mode.- -
If the indexth node in current parent is not a +
Text
node, or is aText
node that is not inter-element + whitespace, then jump to the step labeled base mode.- +
Annotation mode increment: Let lookahead index be index plus - one.
- -
Annotation mode increment: Let lookahead index be index plus one.
Annotation mode white-space skipper: If lookahead index is equal to the number of child - nodes in current parent then jump to the step +
- -
Annotation mode white-space skipper: If lookahead index is + equal to the number of child nodes in current parent then jump to the step labeled end mode.
- +
If the lookahead indexth node in current parent is an
rt
element or an -rp
element, then set index to lookahead index and jump to the step labeled - annotation mode.- -
If the lookahead indexth node in current parent is + an
rt
element or anrp
element, then set index to + lookahead index and jump to the step labeled annotation mode.- +
If the lookahead indexth node in current parent is not a
Text
node, or - is aText
node that is not inter-element - whitespace, then jump to the step labeled base mode - (without further incrementing index, so the - inter-element whitespace seen so far becomes part of - the next base text segment).- -
If the lookahead indexth node in current parent is + not a
Text
node, or is aText
node that is not inter-element + whitespace, then jump to the step labeled base mode (without further incrementing + index, so the inter-element whitespace seen so far becomes part + of the next base text segment).- +
Increment lookahead index by - one.
- -
Increment lookahead index by one.
- +
Jump to the step labeled annotation mode white-space - skipper.
- -
Jump to the step labeled annotation mode white-space skipper.
End mode: If current parent is - not the same element as root, then pop a - ruby level and jump to the step labeled base mode +
- -
End mode: If current parent is not the same element as root, then pop a ruby level and jump to the step labeled base mode post-increment.
- +
End: Return base text segments - and annotation segments. Any content of the -
ruby
element not described by segments in either of - thost lists is implicitly in an ignored segment.- -
End: Return base text segments and annotation + segments. Any content of the
ruby
element not described by segments in either + of thost lists is implicitly in an ignored segment.When the steps above say to set the current base text, - it means to run the following steps at that point in the - algorithm:
+When the steps above say to set the current base text, it means to run the following + steps at that point in the algorithm:
-
- +
Let text range a DOM range whose start is the boundary point (current parent, start index) and - whose end is the boundary point (current parent, index).
- -
Let text range a DOM range whose start is the boundary + point (current parent, start index) and whose + end is the boundary + point (current parent, index).
Let new text segment be a base text - segment described by the range annotation - range.
+Let new text segment be a base text segment described by the range + annotation range.
-- +
Add new text segment to base text segments.
- -
Add new text segment to base text + segments.
- +
Let current base text be new text segment.
Let current base text be new text + segment.
- -
Let start index be null.
When the steps above say to push a ruby level, it - means to run the following steps at that point in the algorithm:
+When the steps above say to push a ruby level, it means to run the following steps + at that point in the algorithm:
-
- +
Let current parent be the indexth node in current - parent.
Let current parent be the indexth node in current parent.
- -
Let index be 0.
- +
Set saved start index to the value of - start index.
Set saved start index to the value of start + index.
- -
Let start index be null.
When the steps above say to pop a ruby level, it means - to run the following steps at that point in the algorithm:
+When the steps above say to pop a ruby level, it means to run the following steps at + that point in the algorithm:
-
- +
Let index be the position of current parent in root.
Let index be the position of current parent in + root.
Let current parent be root.
- -
Increment index by one.
- +
Set start index to the value of - saved start index.
Set start index to the value of saved start + index.
- -
Let saved start index be null.
When the steps above say to push a ruby annotation, it - means to run the following steps at that point in the algorithm:
+When the steps above say to push a ruby annotation, it means to run the following + steps at that point in the algorithm:
-
- +
Let rt be the
rt
element - that is the indexth node of current parent.
- -
Let rt be the
rt
element that is the indexth node of current parent.- +
Let annotation range a DOM range whose - start is the boundary point (current parent, index) and whose - end is the boundary point (current parent, index plus one) - (i.e. that contains only rt).
- -
Let annotation range a DOM range whose start is the boundary + point (current parent, index) and whose end is the boundary point + (current parent, index plus one) (i.e. that contains only + rt).
- +
Let new annotation segment be an - annotation segment described by the range annotation - range.
- -
Let new annotation segment be an annotation segment described by the + range annotation range.
- +
If current base text is not null, - associate new annotation segment with current base text.
- -
If current base text is not null, associate new + annotation segment with current base text.
- +
Add new annotation segment to annotation segments.
Add new annotation segment to annotation + segments.
-In this example, each ideograph in the Japanese text 漢字 is annotated with its - reading in hiragana.
+In this example, each ideograph in the Japanese text 漢字 is annotated with its reading in hiragana.
... <ruby>漢<rt>かん</rt>字<rt>じ</rt></ruby> @@ -22902,9 +22677,7 @@ wormhole connection.</mark></p>-In this example, each ideograph in the traditional Chinese text - 漢字 is annotated - with its bopomofo reading.
+In this example, each ideograph in the traditional Chinese text 漢字 is annotated with its bopomofo reading.
<ruby>漢<rt>ㄏㄢˋ</rt>字<rt>ㄗˋ</rt></ruby>@@ -22918,9 +22691,7 @@ wormhole connection.</mark></p> -In this example, each ideograph in the simplified Chinese text - 汉字 is annotated - with its pinyin reading.
+In this example, each ideograph in the simplified Chinese text 汉字 is annotated with its pinyin reading.
...<ruby>汉<rt>hàn</rt>字<rt>zì</rt></ruby>...@@ -22934,11 +22705,10 @@ wormhole connection.</mark></p>-@@ -26480,6 +26246,9 @@ href="?audio">audio</a> test instead.)</p> +In this more contrived example, the acronym "HTML" has four - annotations: one for the whole acronym, briefly describing what it - is, one for the letters "HT" expanding them to "Hypertext", one for - the letter "M" expanding it to "Markup", and one for the letter "L" - expanding it to "Language".
+In this more contrived example, the acronym "HTML" has four annotations: one for the whole + acronym, briefly describing what it is, one for the letters "HT" expanding them to "Hypertext", + one for the letter "M" expanding it to "Markup", and one for the letter "L" expanding it to + "Language".
<ruby> <ruby>HT<rt>Hypertext</rt>M<rt>Markup</rt>L<rt>Language</rt></ruby> @@ -24841,21 +24611,17 @@ interface HTMLImageElement : Theimg
element is completely available.Otherwise, the attribute must return false.
-The value of
+complete
can thus change while a - script is executing.The value of
-complete
can thus change while + a script is executing.Three constructors are provided for creating -
+HTMLImageElement
objects (in addition to the factory - methods from DOM Core such ascreateElement()
):Image()
,Image(width)
, andImage(width, height)
. When invoked as constructors, - these must return a newHTMLImageElement
object (a new -img
element). If the width argument - is present, the new object'swidth
content attribute must be set to - width. If the height - argument is also present, the new object'sheight
content attribute must be set - to height. The element's document must be the - active document of the browsing context of - theWindow
object on which the interface object of the - invoked constructor is found.Three constructors are provided for creating
HTMLImageElement
objects (in addition + to the factory methods from DOM such ascreateElement()
):Image()
,Image(width)
, andImage(width, height)
. When invoked as constructors, + these must return a newHTMLImageElement
object (a newimg
element). If + the width argument is present, the new object'swidth
content attribute must be set to width. If + the height argument is also present, the new object'sheight
content attribute must be set to height. + The element's document must be the active document of the browsing + context of theWindow
object on which the interface object of the invoked + constructor is found.- +
The nested browsing context's
Window
object's + cross-boundary event parent is the browsing context container. [DOM]If the attribute is not specified, or if the origin conditions listed above are not met, then the user agent should render the nested browsing context in a manner that is clearly distinguishable as a separate browsing context, and the @@ -28085,19 +27854,15 @@ interface HTMLAudioElement :
+ [DOMEVENTS]-@@ -34692,7 +34457,7 @@ interface HTMLCanvasElement : fallback content. (Focus has no effect on mouse interaction events.) - [DOMEVENTS]Two constructors are provided for creating -
+HTMLAudioElement
objects (in addition to the factory - methods from DOM Core such ascreateElement()
):Audio()
andAudio(src)
. When invoked as constructors, - these must return a newHTMLAudioElement
object (a new -audio
element). The element must have itspreload
attribute set to the - literal value "auto
". If the src argument is present, the object created must have - itssrc
content attribute set to - the provided value, and the user agent must invoke the object's - resource selection - algorithm before returning. The element's document must be - the active document of the browsing - context of theWindow
object on which the - interface object of the invoked constructor is found.Two constructors are provided for creating
HTMLAudioElement
objects (in addition + to the factory methods from DOM such ascreateElement()
):Audio()
andAudio(src)
. When invoked as constructors, these must return a new +HTMLAudioElement
object (a newaudio
element). The element must have its +preload
attribute set to the literal value "auto
". If the src argument is present, + the object created must have itssrc
content attribute set to + the provided value, and the user agent must invoke the object's resource selection algorithm before returning. The + element's document must be the active document of the browsing context + of theWindow
object on which the interface object of the invoked constructor is + found.The
canvas
element has two attributes to control the size of the coordinate space:width
andheight
. These attributes, when specified, must have @@ -52452,67 +52217,52 @@ interface HTMLOptionElement :-@@ -69441,7 +69191,7 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUThe
- -disabled
- IDL attribute must reflect the content attribute of the - same name. ThedefaultSelected
- IDL attribute must reflect theselected
content attribute.The
- -label
IDL - attribute, on getting, must return the element's label. On setting, the element's -label
content attribute must - be set to the new value.The
- -value
IDL - attribute, on getting, must return the element's value. On setting, the element's -value
content attribute must - be set to the new value.The
- -selected
- IDL attribute, on getting, must return true if the element's selectedness is true, and - false otherwise. On setting, it must set the element's selectedness to the new - value, and then cause the element to ask for a reset.The
- -index
IDL - attribute must return the element's index.The
- -text
IDL - attribute, on getting, must return the value of the -textContent
IDL attribute on the element, with leading and trailing - whitespace stripped, and with any sequences of two or more - space characters replaced by a - single U+0020 SPACE character. On setting, it must act as if the -textContent
IDL attribute on the element had been set - to the new value.The
- -form
IDL - attribute's behavior depends on whether theoption
- element is in aselect
element or not. If the -option
has aselect
element as its parent, - or has anoptgroup
element as its parent and that -optgroup
element has aselect
element as - its parent, then theform
IDL - attribute must return the same value as theform
IDL attribute on that -select
element. Otherwise, it must return null.Several constructors are provided for creating -
+HTMLOptionElement
objects (in addition to the factory - methods from DOM Core such ascreateElement()
):Option()
,Option(text)
,Option(text, value)
,Option(text, value, defaultSelected)
, andOption(text, value, defaultSelected, selected)
. When invoked as constructors, - these must return a newHTMLOptionElement
object (a new -option
element). If the text - argument is present, the new object must have as its only child a -Text
node whose data is the value of that argument. If - the value argument is present, the new object - must have avalue
attribute - set with the value of the argument as its value. If the defaultSelected argument is present and true, the new - object must have aselected
attribute set with no - value. If the selected argument is present and - true, the new object must have its selectedness set to true; - otherwise the fourth argument is absent or false, and the selectedness must be set - to false, even if the defaultSelected argument - is present and true. The element's document must be the active - document of the browsing context of the -Window
object on which the interface object of the - invoked constructor is found.The
+ +disabled
IDL attribute must + reflect the content attribute of the same name. ThedefaultSelected
IDL attribute must + reflect theselected
content attribute.The
+ +label
IDL attribute, on getting, must + return the element's label. On setting, the element's +label
content attribute must be set to the new value.The
+ +value
IDL attribute, on getting, must + return the element's value. On setting, the element's +value
content attribute must be set to the new value.The
+ +selected
IDL attribute, on getting, + must return true if the element's selectedness is + true, and false otherwise. On setting, it must set the element's selectedness to the new value, and then cause the + element to ask for a reset.The
+ +index
IDL attribute must return the + element's index.The
+ +text
IDL attribute, on getting, must return + the value of thetextContent
IDL attribute on the element, with leading and trailing whitespace stripped, and with any + sequences of two or more space characters replaced by a + single U+0020 SPACE character. On setting, it must act as if thetextContent
IDL + attribute on the element had been set to the new value.The
+ +form
IDL attribute's behavior depends on + whether theoption
element is in aselect
element or not. If the +option
has aselect
element as its parent, or has an +optgroup
element as its parent and thatoptgroup
element has a +select
element as its parent, then theform
IDL + attribute must return the same value as theform
IDL attribute + on thatselect
element. Otherwise, it must return null.Several constructors are provided for creating
HTMLOptionElement
objects (in + addition to the factory methods from DOM such ascreateElement()
):Option()
,Option(text)
,Option(text, value)
,Option(text, value, defaultSelected)
, andOption(text, value, defaultSelected, selected)
. When invoked as constructors, these must return a new +HTMLOptionElement
object (a newoption
element). If the text argument is present, the new object must have as its only child a +Text
node whose data is the value of that argument. If the value + argument is present, the new object must have avalue
+ attribute set with the value of the argument as its value. If the defaultSelected argument is present and true, the new object must have aselected
attribute set with no value. If the selected argument is present and true, the new object must have its selectedness set to true; otherwise the fourth argument + is absent or false, and the selectedness must be + set to false, even if the defaultSelected argument is present and true. The + element's document must be the active document of the browsing context + of theWindow
object on which the interface object of the invoked constructor is + found.When faced with displaying an XML file inline, user agents must first create a
+ recommendations, RFC 3023, DOM, and other relevant specifications. [XML] [XMLNS] [RFC3023] [DOM]Document
object, following the requirements of the XML and Namespaces in XML - recommendations, RFC 3023, DOM Core, and other relevant specifications. [XML] [XMLNS] [RFC3023] [DOMCORE]The actual HTTP headers and other metadata, not the headers as mutated or implied by the algorithms given in this specification, are the ones that must be used when determining the @@ -73421,6 +73171,7 @@ interface NavigatorOnLine { tasks queued with the user interaction task source. [DOMEVENTS]
+ @@ -73599,104 +73350,86 @@ interface NavigatorOnLine { -Many objects can have event handlers specified. These - act as non-capture event listeners for the object on which they are - specified. [DOMCORE]
+Many objects can have event handlers specified. These act as non-capture event + listeners for the object on which they are specified. [DOM]
-An event handler can either - have the value null or be set to a callback object. This is defined - using the
+EventHandler
callback interface type. Initially, event handlers must be set to - null.An event handler can either have the value null or be set + to a callback object. This is defined using the
EventHandler
callback interface type. + Initially, event handlers must be set to null.Event handlers are exposed in one of two ways.
-The first way, common to all event handlers, is as an event handler IDL - attribute.
+The first way, common to all event handlers, is as an event handler IDL attribute.
-The second way is as an event handler content attribute. Event handlers - on HTML elements and some of the event handlers on +
The second way is as an event handler content + attribute. Event handlers on HTML elements and some of the event handlers on
Window
objects are exposed in this way.--Event handler IDL attributes, on setting, must set the - corresponding event handler to their new value, and on - getting, must return whatever the current value of the corresponding +
Event handler IDL attributes, on setting, must set the corresponding event handler + to their new value, and on getting, must return whatever the current value of the corresponding event handler is (possibly null).
-If an event handler - IDL attribute exposes an event - handler of an object that doesn't exist, it must always +
If an event handler IDL attribute exposes an + event handler of an object that doesn't exist, it must always return null on getting and must do nothing on setting.
-This can happen in particular for event handler IDL attribute on -
body
elements that do not have corresponding +This can happen in particular for event + handler IDL attribute on
-body
elements that do not have correspondingWindow
objects.Certain event handler IDL attributes have additional - requirements, in particular the
onmessage
attribute of +Certain event handler IDL attributes have additional requirements, in particular + the
-onmessage
attribute ofMessagePort
objects.On getting, event handler IDL attributes must return - the value of their corresponding event handlers, except when the - value is an internal error - value, in which case the user agent must set the corresponding - event handler to null, and then throw an exception corresponding to - the error condition.
+On getting, event handler IDL attributes must return the value of their + corresponding event handlers, except when the value is an internal error value, in which case the user agent must set + the corresponding event handler to null, and then throw an exception corresponding to the error + condition.
Event handler content attributes, when specified, must - contain valid JavaScript code which, when parsed, would match the -
FunctionBody
production after automatic +Event handler content attributes, when specified, must contain valid JavaScript code + which, when parsed, would match the
FunctionBody
production after automatic semicolon insertion. [ECMA262]-When an event - handler content attribute is set, if the element is owned by - a
- -Document
that is in a browsing context, - and scripting is enabled for - that browsing context, the user agent must run the - following steps to create a script after setting the content - attribute to its new value:
- - -
Set the corresponding event - handler to null.
- +
Set up a script execution environment for - JavaScript.
When an event handler content attribute + is set, if the element is owned by a
+ +Document
that is in a browsing + context, and scripting is enabled for that + browsing context, the user agent must run the following steps to create a script after setting the content attribute to its new value:
- + +
Set the corresponding event handler to null.
- -
Set up a script execution environment for JavaScript.
- +
Let body be the event handler content - attribute's new value.
Let body be the event + handler content attribute's new value.
- -
If body is not parsable as - FunctionBody or if parsing detects an early error - then set the event handler content attribute to an - error as defined below, and abort these steps.
+If body is not parsable as FunctionBody or if parsing detects an + early error then set the event handler content attribute to an error as + defined below, and abort these steps.
-FunctionBody is defined in ECMAScript - edition 5 section 13 Function Definition. Early error is - defined in ECMAScript edition 5 section 16 Errors. [ECMA262]
+FunctionBody is defined in ECMAScript edition 5 section 13 Function + Definition. Early error is defined in ECMAScript edition 5 section 16 Errors. [ECMA262]
- -
@@ -73704,31 +73437,27 @@ interface NavigatorOnLine { currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11977#c4If body begins with a Directive Prologue - that contains a Use Strict Directive then let strict be true, otherwise let strict be false.
+If body begins with a Directive Prologue that contains a Use Strict + Directive then let strict be true, otherwise let strict + be false.
-The terms "Directive Prologue" and "Use Strict - Directive" are defined in ECMAScript edition 5 section 14.1 - Directive Prologues and the Use Strict Directive. [ECMA262]
+The terms "Directive Prologue" and "Use Strict Directive" are defined in + ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. [ECMA262]
- -
-->If strict is true, and anything in body is a
+SyntaxError
according to the - Strict Mode Restrictions, then set the event handler content - attribute to an error as defined below, and abort these - steps.If strict is true, and anything in body is a +
-SyntaxError
according to the Strict Mode Restrictions, then set the event + handler content attribute to an error as defined below, and abort these steps.The Strict Mode Restrictions are those listed in - ECMAScript edition 5 section 13.1 Strict Mode Restrictions. [ECMA262]
+The Strict Mode Restrictions are those listed in ECMAScript edition 5 section + 13.1 Strict Mode Restrictions. [ECMA262]
- -
-Using the script execution environment created above, create a - function object (as defined in ECMAScript edition 5 section 13.2 - Creating Function Objects), with:
+Using the script execution environment created above, create a function object (as defined in + ECMAScript edition 5 section 13.2 Creating Function Objects), with:
- Parameter list FormalParameterList
- -
- If the attribute is the
+onerror
attribute of the -Window
object
- If the attribute is the
onerror
attribute of + theWindow
object- Let the function have four arguments, named
@@ -73747,18 +73476,17 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119event
,source
,lineno
, andcolumn
.- -
@@ -73766,35 +73494,29 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119
- Let Scope be the result of - NewObjectEnvironment(the element's
+Document
, the - global environment).
- Let Scope be the result of NewObjectEnvironment(the element's +
-Document
, the global environment).- If the element has a form owner, let Scope be the result of NewObjectEnvironment(the - element's form owner, Scope).
+- If the element has a form owner, let Scope be the result + of NewObjectEnvironment(the element's form owner, Scope).
-- Let Scope be the result of - NewObjectEnvironment(the element's object, Scope).
+- Let Scope be the result of NewObjectEnvironment(the element's object, + Scope).
-NewObjectEnvironment() is defined in ECMAScript - edition 5 section 10.2.2.3 NewObjectEnvironment (O, E). [ECMA262]
+NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3 + NewObjectEnvironment (O, E). [ECMA262]
- The value of strict.
-Let this new function be the only entry in the script's - list of code entry-points.
+Let this new function be the only entry in the script's list of code + entry-points.
Set up the script's global object, the - script's browsing context, the script's - document, the script's referrer source, the - script's URL character encoding, and the - script's base URL from the script settings - determined from the node on which the attribute is being +
- -
Set up the script's global object, the script's browsing + context, the script's document, the script's referrer source, + the script's URL character encoding, and the script's base URL from + the script settings determined from the node on which the attribute is being set.
- - -
Set the corresponding event - handler to the aforementioned function.
When a user agent is required, by the steps above, to set - the event handler content attribute to an error, the user - agent must set the corresponding event - handler to an internal - error value representing the error condition, keeping track of - the URL of the resource where the event handler content attribute - was set, and the relevant line number inside that resource where the - error occurred.
- -When an event handler content attribute is removed, the user - agent must set the corresponding event - handler to null.
+- + +
Set the corresponding event handler to the + aforementioned function.
When a user agent is required, by the steps above, to set the event handler content + attribute to an error, the user agent must set the corresponding event handler to an internal error value + representing the error condition, keeping track of the URL of the resource where the + event handler content attribute was set, and + the relevant line number inside that resource where the error occurred.
+ +When an event handler content attribute is removed, the user agent must set the corresponding + event handler to null.
-When an event handler H of an element or object T - implementing the
- -EventTarget
interface is first set to - a non-null value, the user agent must append an event listener to the list of - event listeners - associated with T with type set to the - event handler event type corresponding to H, capture set to false, and listener - set to the event handler processing algorithm defined - below. [DOMCORE]The listener is emphatically not the - event handler itself. Every - event handler ends up registering the same listener, the - algorithm defined below, which takes care of invoking the right - callback, and processing the callback's return value.
- -This only happens the first time the event handler's value is set. Since - listeners are called in the order they were registered, the order of - event listeners for a particular event type will always be first the - event listeners registered with
+addEventListener()
- before the first time the event - handler was set to a non-null value, then the callback to - which it is currently set, if any, and finally the event listeners - registered withaddEventListener()
- after the first time the event - handler was set to a non-null value.When an event handler H of an element + or object T implementing the
+ +EventTarget
interface is first set + to a non-null value, the user agent must append an event + listener to the list of event listeners + associated with T with type set to the event handler event + type corresponding to H, capture set to false, and + listener set to the event handler processing algorithm defined below. [DOM]The listener is emphatically not the event handler itself. Every event handler ends up registering the same + listener, the algorithm defined below, which takes care of invoking the right callback, and + processing the callback's return value.
+ +This only happens the first time the event + handler's value is set. Since listeners are called in the order they were registered, the + order of event listeners for a particular event type will always be first the event listeners + registered with
addEventListener()
before + the first time the event handler was set to a non-null value, + then the callback to which it is currently set, if any, and finally the event listeners registered + withaddEventListener()
after the + first time the event handler was set to a non-null value.-This example demonstrates the order in which event listeners are - invoked. If the button in this example is clicked by the user, the - page will show four alerts, with the text "ONE", "TWO", "THREE", - and "FOUR" respectively.
+This example demonstrates the order in which event listeners are invoked. If the button in + this example is clicked by the user, the page will show four alerts, with the text "ONE", "TWO", + "THREE", and "FOUR" respectively.
<button id="test">Start Demo</button> <script> @@ -73862,15 +73577,13 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119--The interfaces implemented by the event object do - not influence whether an event - handler is triggered or not.
+The interfaces implemented by the event object do not influence whether an event handler is triggered or not.
-The event handler processing algorithm for an - event handler H and an
+Event
object E is as follows:The event handler processing algorithm for an event + handler H and an
-Event
object E is as + follows:
- +
If H's value is null, then abort these - steps.
If H's value is null, then abort these steps.
- -
If H's value is an internal error value, then set the event handler to null and then @@ -73880,14 +73593,11 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119 handlers">event handler of the
Window
object of thatDocument
, and abort these steps.- +
Let callback be H's - value, the callback that the event - handler was last set to.
- -
Let callback be H's value, the callback that the + event handler was last set to.
- +
Invoke callback with one - argument, the value of which is the
Event
object E, with the callback this value set to - E'scurrentTarget
. Let the - return value be return value. [WEBIDL]Invoke callback with one argument, the value of which is the +
Event
object E, with the callback this value set to E'scurrentTarget
. Let the return value be return value. [WEBIDL]- @@ -73895,21 +73605,19 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119
- If the event type is
-mouseover
- +
If return value is a boolean with the - value true, then cancel the event.
- -
If return value is a boolean with the value true, then cancel the + event.
- If the
+Event
object E is a -BeforeUnloadEvent
object- If the
-Event
object E is aBeforeUnloadEvent
+ object- +
If return value is a string, and the -
Event
object E'sreturnValue
- attribute's value is the empty string, then set thereturnValue
- attribute's value to return value.If return value is a string, and the
Event
object E'sreturnValue
+ attribute's value is the empty string, then set thereturnValue
attribute's value to return value.- Otherwise
-- +
If return value is a boolean with the - value false, then cancel the event.
- @@ -73917,16 +73625,14 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119
If return value is a boolean with the value false, then cancel the + event.
The
+EventHandler
interface represents a callback - used for event handlers. It is represented in Web IDL as - follows:The
EventHandler
interface represents a callback used for event handlers. It is + represented in Web IDL as follows:[TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event); typedef EventHandlerNonNull? EventHandler;-In JavaScript, any
+Function
object - implements this interface.In JavaScript, any
Function
object implements this interface.@@ -73934,19 +73640,17 @@ typedef EventHandlerNonNull? <body onload="alert(this)" onclick="alert(this)"> --...leads to an alert saying "
+[object Window]
" when the document is loaded, - and an alert saying "[object HTMLBodyElement]
" whenever the user - clicks something in the page....leads to an alert saying "
[object Window]
" when the document is + loaded, and an alert saying "[object HTMLBodyElement]
" whenever the + user clicks something in the page.The return value of the function affects whether the - event is canceled or not: as described - above, if the return value is false, the event is canceled - (except for
+mouseover
events, - where the return value has to be true to cancel the event). With -beforeunload
events, the - value is instead used to determine the message to show the user.The return value of the function affects whether the event is canceled or not: + as described above, if the return value is false, the event is canceled + (except for
mouseover
events, where the return value has to + be true to cancel the event). Withbeforeunload
events, + the value is instead used to determine the message to show the user.For historical reasons, the
@@ -73960,12 +73664,10 @@ typedef OnErrorEventHandlerNonNull? 7.1.6.2 Event handlers on elements,onerror
handler has different arguments:Document
objects, andWindow
objects -The following are the event handlers (and their - corresponding event handler - event types) that must be supported - by all HTML elements, as both content attributes and - IDL attributes, and on
+Document
andWindow
- objects, as IDL attributes.The following are the event handlers (and their corresponding event handler event types) that must be + supported by all HTML elements, as both content attributes and IDL attributes, and on +
Document
andWindow
objects, as IDL attributes.
Event handler Event handler event type onabort
abort
@@ -74122,12 +73824,15 @@ typedef OnErrorEventHandlerNonNull? 7.1.6.4 Events and theWindow
object -When an event is dispatched at a DOM node in a -
+Document
in a browsing context, if the - event is not aload
event, the user - agent must act as if, for the purposes of event dispatching, the -Window
object is the parent of the -Document
object. [DOMCORE]When an event is dispatched at a DOM node in a
+ + @@ -82211,9 +81916,9 @@ interface WorkerUtils { WorkerUtils implements WindowBase64; -Document
in a browsing + context, if the event is not aload
event, the user agent + must act as if, for the purposes of event dispatching, + theWindow
object is the parent of theDocument
object. [DOM]The DOM APIs — specifically, all the interfaces defind in the DOM Core specification - other than exceptions — must not be exposed if the - JavaScript global environment is a worker environment. [DOMCORE]
+The DOM APIs — specifically, all the interfaces defind in the DOM specification other + than exceptions — must not be exposed if the JavaScript + global environment is a worker environment. [DOMCORE]
9.3.1 Importing scripts and libraries
@@ -90625,7 +90330,7 @@ document.body.appendChild(text);DOM mutation events must not fire for changes caused by the UA parsing the document. This includes the parsing of any content inserted using
-document.write()
anddocument.writeln()
calls. [DOMEVENTS]However, mutation observers do fire, as required by the DOM Core specification.
+However, mutation observers do fire, as required by the DOM specification.
Not all of the tag names mentioned below are conformant tag names in this specification; many are included to @@ -95322,42 +95027,37 @@ document.body.appendChild(text);
13.2 Parsing XHTML documents
-This section describes the relationship between XML and the DOM, - with a particular emphasis on how this interacts with HTML.
+This section describes the relationship between XML and the DOM, with a particular emphasis on + how this interacts with HTML.
-An XML parser, for the purposes of this specification, - is a construct that follows the rules given in the XML specification - to map a string of bytes or characters into a
+Document
- object.An XML parser, for the purposes of this specification, is a construct that follows + the rules given in the XML specification to map a string of bytes or characters into a +
-Document
object.An XML parser is either associated with a -
+Document
object when it is created, or creates one - implicitly.An XML parser is either associated with a
Document
object when it is + created, or creates one implicitly.This
+ into a document or has its attributes set, and the DOM specification's requirements regarding + mutation observers mean that mutation observers are fired (unlike mutation events). [XML] [XMLNS] [DOM] [DOMEVENTS] -Document
must then be populated with DOM nodes that represent the tree structure of the input passed to the parser, as defined by the XML specification, the Namespaces - in XML specification, and the DOM Core specification. DOM mutation events must not fire for the + in XML specification, and the DOM specification. DOM mutation events must not fire for the operations that the XML parser performs on theDocument
's tree, but the user agent must act as if elements and attributes were individually appended and set respectively so as to trigger rules in this specification regarding what happens when an element is inserted - into a document or has its attributes set, and the DOM Core specification's requirements regarding - mutation observers mean that mutation observers are fired (unlike mutation events). [XML] [XMLNS] [DOMCORE] [DOMEVENTS]Between the time an element's start tag is parsed and the time - either the element's end tag is parsed or the parser detects a - well-formedness error, the user agent must act as if the element was - in a stack of open elements.
+Between the time an element's start tag is parsed and the time either the element's end tag is + parsed or the parser detects a well-formedness error, the user agent must act as if the element + was in a stack of open elements.
-This is used by the
+object
element to - avoid instantiating plugins before theparam
element - children have been parsed.This is used by the
-object
element to avoid instantiating plugins + before theparam
element children have been parsed.This specification provides the following additional information - that user agents should use when retrieving an external entity: the - public identifiers given in the following list all correspond to the URL given by this - link. (This URL is a DTD containing the entity reference - declarations for the names listed in the named character - references section.)
+This specification provides the following additional information that user agents should use + when retrieving an external entity: the public identifiers given in the following list all + correspond to the URL given by this link. (This + URL is a DTD containing the entity reference declarations for the names listed in the named + character references section.)
-//W3C//DTD XHTML 1.0 Transitional//EN
- @@ -95539,23 +95239,19 @@ document.body.appendChild(text);
-//W3C//DTD XHTML 1.1//EN
- -
@@ -98676,7 +98372,7 @@ if (s = prompt('What is your name?')) {If there is a context element, - feed the parser just created the string corresponding - to the start tag of that element, declaring all the namespace - prefixes that are in scope on that element in the DOM, as well as - declaring the default namespace (if any) that is in scope on that - element in the DOM.
+If there is a context element, feed the + parser just created the string corresponding to the start tag of that element, declaring + all the namespace prefixes that are in scope on that element in the DOM, as well as declaring + the default namespace (if any) that is in scope on that element in the DOM.
-A namespace prefix is in scope if the DOM Core
+lookupNamespaceURI()
method on the element would - return a non-null value for that prefix.A namespace prefix is in scope if the DOM
-lookupNamespaceURI()
method + on the element would return a non-null value for that prefix.The default namespace is the namespace for which the DOM Core -
+isDefaultNamespace()
method on the element - would return true.The default namespace is the namespace for which the DOM
-isDefaultNamespace()
method on the element would return true.If there is a context element, no
+DOCTYPE
is passed to the parser, and therefore no - external subset is referenced, and therefore no entities will be - recognized.If there is a context element, no +
DOCTYPE
is passed to the parser, and therefore no external subset is + referenced, and therefore no entities will be recognized.event
onscript
elements- -
for
onscript
elements- +
Use DOM Events mechanisms to register event listeners. [DOMCORE]
Use DOM Events mechanisms to register event listeners. [DOM]
datapagesize
ontable
elements- @@ -103917,14 +103613,14 @@ if (s = prompt('What is your name?')) {
Unnecessary. Omit it altogether.
- [DASH]
- Dynamic adaptive streaming over HTTP (DASH). ISO.
-- [DOMCORE]
-- Web DOM Core, A. van Kesteren. WHATWG.
+- [DOM]
+- DOM, A. van Kesteren, A. Gregor, Ms2ger. WHATWG.
- [DOMEVENTS]
- Document Object Model (DOM) Level 3 Events Specification, T. Leithead, J. Rossi, D. Schepers, B. Höhrmann, P. Le Hégaret, T. Pixley. W3C.
- [DOMPARSING]
-- DOM Parsing and Serialization, Ms2ger. html5.org.
+- DOM Parsing and Serialization, Ms2ger. WHATWG.
- [DOT]
- (Non-normative) The DOT Language. Graphviz.
@@ -103939,7 +103635,7 @@ if (s = prompt('What is your name?')) {- (Non-normative) ECMAScript for XML (E4X) Specification. ECMA.
- [EDITING]
-- HTML Editing APIs, A. Gregor.
+- HTML Editing APIs, A. Gregor. W3C Editing APIs CG.
- [EUCKR]
- Hangul Unix Environment. Korea Industrial Standards Association. Ref. No. KS C 5861-1992.
diff --git a/source b/source index a58a5e2a0fd..88ca4b6c2dc 100644 --- a/source +++ b/source @@ -24,10 +24,10 @@ interface ArrayBuffer { }; // TypedArray interface ArrayBufferView { }; // TypedArray interface Uint8ClampedArray { }; // TypedArray - interface XMLDocument { }; // DOM Core - interface HTMLCollection { }; // DOM Core - interface DOMTokenList { }; // DOM Core - interface DOMSettableTokenList { attribute any value; }; // DOM Core + interface XMLDocument { }; // DOM + interface HTMLCollection { }; // DOM + interface DOMTokenList { }; // DOM + interface DOMSettableTokenList { attribute any value; }; // DOM interface SVGMatrix { }; // SVG @@ -73,7 +73,7 @@ relative to other specifications can be best summed up as follows: -+
@@ -404,24 +404,21 @@
This section is non-normative.
-This specification is intended for authors of documents and - scripts that use the features defined in this specification, implementors of tools that operate on pages that use - the features defined in this specification, and individuals wishing - to establish the correctness of documents or implementations with - respect to the requirements of this specification.
+This specification is intended for authors of documents and scripts that use the features + defined in this specification, implementors of tools that operate on pages that + use the features defined in this specification, and individuals wishing to establish the + correctness of documents or implementations with respect to the requirements of this + specification.
-This document is probably not suited to readers who do not - already have at least a passing familiarity with Web technologies, - as in places it sacrifices clarity for precision, and brevity for - completeness. More approachable tutorials and authoring guides can - provide a gentler introduction to the topic.
+This document is probably not suited to readers who do not already have at least a passing + familiarity with Web technologies, as in places it sacrifices clarity for precision, and brevity + for completeness. More approachable tutorials and authoring guides can provide a gentler + introduction to the topic.
-In particular, familiarity with the basics of DOM Core and DOM - Events is necessary for a complete understanding of some of the more - technical parts of this specification. An understanding of Web IDL, - HTTP, XML, Unicode, character encodings, JavaScript, and CSS will - also be helpful in places but is not essential.
+In particular, familiarity with the basics of DOM is necessary for a complete understanding of + some of the more technical parts of this specification. An understanding of Web IDL, HTTP, XML, + Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not + essential.
Scope
@@ -2021,72 +2018,57 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute dTerminology
-This specification refers to both HTML and XML attributes and IDL - attributes, often in the same context. When it is not clear which is - being referred to, they are referred to as content - attributes for HTML and XML attributes, and IDL - attributes for those defined on IDL interfaces. Similarly, the - term "properties" is used for both JavaScript object properties and - CSS properties. When these are ambiguous they are qualified as object properties and CSS - properties respectively.
- -Generally, when the specification states that a feature applies - to the HTML syntax or the XHTML syntax, it - also includes the other. When a feature specifically only applies to - one of the two languages, it is called out by explicitly stating - that it does not apply to the other format, as in "for HTML, - ... (this does not apply to XHTML)".
- -This specification uses the term document to - refer to any use of HTML, ranging from short static documents to - long essays or reports with rich multimedia, as well as to - fully-fledged interactive applications. The term is used to refer - both to
- -Document
objects and their descendant DOM - trees, and to serialized byte streams using the HTML syntax or XHTML syntax, depending on context.In the context of the DOM structures, the terms HTML document and XML - document are used as defined in the DOM Core specification, - and refer specifically to two different modes that -
- -Document
objects can find themselves in. [DOMCORE] (Such uses are always hyperlinked - to their definition.)In the context of byte streams, the term HTML document refers to - resources labeled as
- -text/html
, and the term XML - document refers to resources labeled with an XML MIME - type.The term XHTML document is used to refer to both -
+Document
s in the XML - document mode that contains element nodes in the HTML - namespace, and byte streams labeled with an XML MIME - type that contain elements from the HTML - namespace, depending on context.This specification refers to both HTML and XML attributes and IDL attributes, often in the same + context. When it is not clear which is being referred to, they are referred to as content attributes for HTML and XML attributes, and IDL + attributes for those defined on IDL interfaces. Similarly, the term "properties" is used for + both JavaScript object properties and CSS properties. When these are ambiguous they are qualified + as object properties and CSS properties respectively.
+ +Generally, when the specification states that a feature applies to the HTML syntax + or the XHTML syntax, it also includes the other. When a feature specifically only + applies to one of the two languages, it is called out by explicitly stating that it does not apply + to the other format, as in "for HTML, ... (this does not apply to XHTML)".
+ +This specification uses the term document to refer to any use of HTML, + ranging from short static documents to long essays or reports with rich multimedia, as well as to + fully-fledged interactive applications. The term is used to refer both to
+ +Document
+ objects and their descendant DOM trees, and to serialized byte streams using the HTML syntax or XHTML syntax, depending + on context.In the context of the DOM structures, the terms HTML + document and XML document are used as defined in the DOM + specification, and refer specifically to two different modes that
+ +Document
objects + can find themselves in. [DOM] (Such uses are always hyperlinked to their + definition.)In the context of byte streams, the term HTML document refers to resources labeled as +
+ +text/html
, and the term XML document refers to resources labeled with an XML + MIME type.The term XHTML document is used to refer to both
Document
s in the XML document mode that contains element nodes in the HTML + namespace, and byte streams labeled with an XML MIME type that contain + elements from the HTML namespace, depending on context.
-For simplicity, terms such as shown, displayed, and visible might - sometimes be used when referring to the way a document is rendered - to the user. These terms are not meant to imply a visual medium; - they must be considered to apply to other media in equivalent - ways.
+For simplicity, terms such as shown, displayed, and + visible might sometimes be used when referring to the way a document is + rendered to the user. These terms are not meant to imply a visual medium; they must be considered + to apply to other media in equivalent ways.
--When an algorithm B says to return to another algorithm A, it - implies that A called B. Upon returning to A, the implementation - must continue from where it left off in calling B.
+When an algorithm B says to return to another algorithm A, it implies that A called B. Upon + returning to A, the implementation must continue from where it left off in calling B.
The term "transparent black" refers to the color with red, green, - blue, and alpha channels all set to zero.
+The term "transparent black" refers to the color with red, green, blue, and alpha channels all + set to zero.
Resources
@@ -2249,28 +2231,25 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute dScripting
-The construction "a
Foo
object", where -Foo
is actually an interface, is sometimes used instead - of the more accurate "an object implementing the interface +The construction "a
-Foo
object", whereFoo
is actually an interface, + is sometimes used instead of the more accurate "an object implementing the interfaceFoo
".An IDL attribute is said to be getting when - its value is being retrieved (e.g. by author script), and is said to - be setting when a new value is assigned to - it.
+An IDL attribute is said to be getting when its value is being retrieved + (e.g. by author script), and is said to be setting when a new value is + assigned to it.
-If a DOM object is said to be live, then the - attributes and methods on that object must - operate on the actual underlying data, not a snapshot of the +
If a DOM object is said to be live, then the attributes and methods on that object + must operate on the actual underlying data, not a snapshot of the data.
In the contexts of events, the terms fire and dispatch are used as defined in the - DOM Core specification: firing an event means to create and - dispatch it, and firing an event means to create and dispatch it, and dispatching an event means to follow the steps that propagate the event through the tree. The term trusted event is used to refer to events whose
+ initialized to true. [DOM]isTrusted
attribute is - initialized to true. [DOMCORE]Plugins
@@ -2909,20 +2888,17 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d- -
The Document Object Model (DOM) is a representation — a - model — of a document and its content. The DOM is not just - an API; the conformance criteria of HTML implementations are - defined, in this specification, in terms of operations on the DOM. - [DOMCORE]
+The Document Object Model (DOM) is a representation — a model — of a document and + its content. The DOM is not just an API; the conformance criteria of HTML implementations are + defined, in this specification, in terms of operations on the DOM. [DOM]
-Implementations must support DOM Core and the events defined in - DOM Events, because this specification is defined in terms of the - DOM, and some of the features are defined as extensions to the DOM - Core interfaces. [DOMCORE] [DOMEVENTS]
+Implementations must support DOM and the events defined in DOM Events, because this + specification is defined in terms of the DOM, and some of the features are defined as extensions + to the DOM interfaces. [DOM] [DOMEVENTS]
-In particular, the following features are defined in the DOM - Core specification: [DOMCORE]
+In particular, the following features are defined in the DOM specification: [DOM]
@@ -2970,6 +2946,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
-isTrusted
attribute- The type of an event
- The concept of an event listener and the event listeners associated with an
+EventTarget
- The concept of a regular event parent and a cross-boundary event parent
- The encoding (herein the character encoding) and content type of a
Document
- The distinction between XML documents and HTML documents
@@ -2986,10 +2963,9 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute dThe term throw in this specification is used as - defined in the DOM Core specification. The following -
+DOMException
types are defined in the DOM Core - specification: [DOMCORE]The term throw in this specification is used as defined in the DOM specification. + The following
DOMException
types are defined in the DOM specification: [DOM]-
- @@ -3015,20 +2991,17 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
IndexSizeError
DataCloneError
For example, to throw a -
+TimeoutError
exception, a user agent would - construct aDOMException
object whose type was the - string "TimeoutError
" (and whose code was - the number 23, for legacy reasons) and actually throw that object - as an exception.For example, to throw a
-TimeoutError
exception, a user + agent would construct aDOMException
object whose type was the string "TimeoutError
" (and whose code was the number 23, for legacy reasons) and + actually throw that object as an exception.The URL associated - with a
+Document
, as defined in the DOM Core - specification, is referred to in this specification as the - document's address.The URL associated with a
-Document
, as + defined in the DOM specification, is referred to in this specification as the document's + address.The following features are defined in the DOM Events - specification: [DOMEVENTS]
+The following features are defined in the DOM Events specification: [DOMEVENTS]
@@ -7311,7 +7284,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d affected by a base URL change.
The following are base URL change steps, which run when an element is - affected by a base URL change (as defined by the DOM Core specification):
+ affected by a base URL change (as defined by the DOM specification):@@ -9002,8 +8975,8 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E.. node of reference. Otherwise, let parent be the
select
element on which theHTMLOptionsCollection
is rooted. -Act as if the DOM Core
insertBefore()
method - was invoked on the parent node, with element as the first +Act as if the DOM
@@ -9503,31 +9476,6 @@ interface Transferable { }; -insertBefore()
method was + invoked on the parent node, with element as the first argument and reference as the second argument.DOM feature strings
- -DOM3 Core defines mechanisms for checking for interface support, - and for obtaining implementations of interfaces, using feature - strings. [DOMCORE]
- -Authors are strongly discouraged from using these, as they are - notoriously unreliable and imprecise. Authors are encouraged to rely - on explicit feature testing or the graceful degradation behavior - intrinsic to some of the features in this specification.
- -- --For historical reasons, user agents should return the true value - when the
- -hasFeature(feature, version)
- method of theDOMImplementation
interface is invoked - with feature set to either "HTML
" or "XHTML
" and version set to either "1.0
" or - "2.0
".@@ -9587,62 +9535,48 @@ interface Transferable { };Documents
-Every XML and HTML document in an HTML UA is represented by a -
- -Document
object. [DOMCORE]The document's address is an absolute URL - that is initially set when the
+Document
is created but - that can change during the lifetime of theDocument
, - for example when the user navigates to - a fragment identifier on the - page or when thepushState()
method is called - with a new URL.Every XML and HTML document in an HTML UA is represented by a
+ +Document
object. [DOM]The document's address is an absolute URL that is initially set when + the
-Document
is created but that can change during the lifetime of the +Document
, for example when the user navigates to a + fragment identifier on the page or when thepushState()
method is called with a new URL.Interactive user agents typically expose - the document's address in their user interface. This is - the primary mechanism by which a user can tell if a site is +
Interactive user agents typically expose the document's address in + their user interface. This is the primary mechanism by which a user can tell if a site is attempting to impersonate another.
-When a
- -Document
is created by a script using thecreateDocument()
- orcreateHTMLDocument()
- APIs, the document's address is the same as the - document's address of the script's document, and - theDocument
is both ready for post-load - tasks and completely loaded immediately.Each
- -Document
object has a reload override - flag that is originally unset. The flag is set by thedocument.open()
anddocument.write()
methods in certain - situations. When the flag is set, theDocument
also has - a reload override buffer which is a Unicode string that - is used as the source of the document when it is reloaded.When the user agent is to perform an overridden - reload, it must act as follows:
+When a
+ +Document
is created by a script using + thecreateDocument()
orcreateHTMLDocument()
APIs, the + document's address is the same as the document's address of the script's + document, and theDocument
is both ready for post-load tasks and + completely loaded immediately.Each
+ +Document
object has a reload override flag that is originally + unset. The flag is set by thedocument.open()
anddocument.write()
methods in certain situations. When the flag is + set, theDocument
also has a reload override buffer which is a Unicode + string that is used as the source of the document when it is reloaded.When the user agent is to perform an overridden reload, it must act as follows:
-
@@ -9650,9 +9584,8 @@ interface Transferable { };- +
Let source be the value of the - browsing context's active document's - reload override buffer.
- -
Let source be the value of the browsing context's + active document's reload override buffer.
- +
Navigate the - browsing context to a resource whose source is source, with replacement enabled. When - the navigate algorithm creates a
Document
- object for this purpose, set thatDocument
's - reload override flag and set its reload override - buffer to source.Navigate the browsing context + to a resource whose source is source, with replacement enabled. + When the navigate algorithm creates a
Document
object for this purpose, + set thatDocument
's reload override flag and set its reload + override buffer to source.The
-Document
objectThe DOM Core specification defines a
+Document
interface, which this specification - extends significantly:The DOM specification defines a
Document
interface, which + this specification extends significantly:[OverrideBuiltins] partial /*sealed*/ interface Document { @@ -11147,30 +11080,25 @@ interface HTMLUnknownElement : HTMLElement { };
The
-id
attributeThe
+id
attribute specifies its - element's unique identifier (ID). [DOMCORE]The
-id
attribute specifies its element's unique identifier (ID). [DOM]The value must be unique amongst all the IDs in the element's home - subtree and must contain at least one character. The value - must not contain any space - characters.
+The value must be unique amongst all the IDs in the element's + home subtree and must contain at least one character. The value must not contain any + space characters.
- + -An element's unique - identifier can be used for a variety of purposes, most - notably as a way to link to specific parts of a document using - fragment identifiers, as a way to target an element when scripting, - and as a way to style a specific element from CSS.
+An element's unique identifier can be used for a + variety of purposes, most notably as a way to link to specific parts of a document using fragment + identifiers, as a way to target an element when scripting, and as a way to style a specific + element from CSS.
-@@ -11767,44 +11695,37 @@ Transport Protocol">HTTP</abbr> today.</p> " -Identifiers are opaque strings. Particular meanings should not be - derived from the value of the
+id
- attribute.Identifiers are opaque strings. Particular meanings should not be derived from the value of the +
id
attribute.The
- -script
element allows authors to include dynamic - script and data blocks in their documents. The element does not - represent content for the user.When used to include dynamic scripts, the scripts may either be - embedded inline or may be imported from an external file using the -
src
attribute. If the language - is not that described by "text/javascript
", - then thetype
attribute must - be present, as described below. Whatever language is used, the - contents of thescript
element must conform with the +The
+ +script
element allows authors to include dynamic script and data blocks in + their documents. The element does not represent content for the + user.When used to include dynamic scripts, the scripts may either be embedded inline or may be + imported from an external file using the
-src
attribute. If + the language is not that described by "text/javascript
", then thetype
attribute must be present, as described below. Whatever + language is used, the contents of thescript
element must conform with the requirements of that language's specification.When used to include data blocks (as opposed to scripts), the - data must be embedded inline, the format of the data must be given - using the
- -type
attribute, the -src
attribute must not be - specified, and the contents of thescript
element must - conform to the requirements defined for the format used.The
- -type
- attribute gives the language of the script or format of the data. If - the attribute is present, its value must be a valid MIME - type. Thecharset
parameter must not be - specified. The default, which is used if the attribute is absent, - is "text/javascript
".The
src
- attribute, if specified, gives the address of the external script - resource to use. The value of the attribute must be a valid - non-empty URL potentially surrounded by spaces identifying a - script resource of the type given by thetype
attribute, if the attribute is - present, or of the type "text/javascript
", if - the attribute is absent. A resource is a script resource of a given - type if that type identifies a scripting language and the resource +When used to include data blocks (as opposed to scripts), the data must be embedded inline, the + format of the data must be given using the
+ +type
attribute, + thesrc
attribute must not be specified, and the contents of + thescript
element must conform to the requirements defined for the format used.The
+ +type
attribute gives the language of the + script or format of the data. If the attribute is present, its value must be a valid MIME + type. Thecharset
parameter must not be specified. The default, which + is used if the attribute is absent, is "text/javascript
".The
-src
attribute, if specified, gives the + address of the external script resource to use. The value of the attribute must be a valid + non-empty URL potentially surrounded by spaces identifying a script resource of the type + given by thetype
attribute, if the attribute is present, or + of the type "text/javascript
", if the attribute is absent. A resource is a + script resource of a given type if that type identifies a scripting language and the resource conforms with the requirements of that language's specification.The
+charset
- attribute gives the character encoding of the external script - resource. The attribute must not be specified if thesrc
attribute is not present. If the - attribute is set, its value must be a valid character encoding name, - must be an ASCII case-insensitive match for the - preferred MIME name for that encoding, and must match - the encoding given in thecharset
parameter of - the Content-Type metadata of the - external file, if any. [IANACHARSET]The
+ +charset
attribute gives the character + encoding of the external script resource. The attribute must not be specified if thesrc
attribute is not present. If the attribute is set, its value + must be a valid character encoding name, must be an ASCII case-insensitive match for + the preferred MIME name for that encoding, and must match the encoding given in the +charset
parameter of the Content-Type + metadata of the external file, if any. [IANACHARSET]The
-async
anddefer
attributes are boolean attributes that indicate how the script should be executed. Thedefer
andasync
attributes + must not be specified if thesrc
attribute is not + present.The
- -async
and -defer
attributes - are boolean attributes that - indicate how the script should be executed. Thedefer
andasync
attributes must not be - specified if thesrc
attribute - is not present.There are three possible modes that can be selected using these - attributes. If the
async
- attribute is present, then the script will be executed - asynchronously, as soon as it is available. If theasync
attribute is not present but - thedefer
attribute is - present, then the script is executed when the page has finished - parsing. If neither attribute is present, then the script is - fetched and executed immediately, before the user agent continues +There are three possible modes that can be selected using these attributes. If the
-async
attribute is present, then the script will be executed + asynchronously, as soon as it is available. If theasync
+ attribute is not present but thedefer
attribute is + present, then the script is executed when the page has finished parsing. If neither attribute is + present, then the script is fetched and executed immediately, before the user agent continues parsing the page.The exact processing details for these attributes - are, for mostly historical reasons, somewhat non-trivial, involving - a number of aspects of HTML. The implementation requirements are - therefore by necessity scattered throughout the specification. The - algorithms below (in this section) describe the core of this - processing, but these algorithms reference and are referenced by the - parsing rules for
- -script
start - and end tags in HTML, in foreign content, and in XML, the rules for thedocument.write()
method, the - handling of scripting, etc.The
+ +defer
attribute may be - specified even if theasync
- attribute is specified, to cause legacy Web browsers that only - supportdefer
(and notThe exact processing details for these attributes are, for mostly historical + reasons, somewhat non-trivial, involving a number of aspects of HTML. The implementation + requirements are therefore by necessity scattered throughout the specification. The algorithms + below (in this section) describe the core of this processing, but these algorithms reference and + are referenced by the parsing rules for
script
start and end tags in HTML, in foreign content, + and in XML, the rules for thedocument.write()
method, the handling of scripting, etc.The
+ title="attr-script-defer">defer behavior instead of the synchronous blocking behavior that + is the default.defer
attribute may be specified even if theasync
attribute is specified, to cause legacy Web browsers that + only supportdefer
(and notasync
) to fall back to thedefer
behavior instead of the - synchronous blocking behavior that is the default.The
crossorigin
attribute is a CORS settings attribute. It controls, for scripts that are obtained from other-@@ -17852,11 +17634,10 @@ c-end = "-->"A
+script
element has several associated pieces of - state.A
-script
element has several associated pieces of state.The first is a flag indicating whether or not the script block - has been "already started". Initially, -
- -script
elements must have this flag unset (script - blocks, when created, are not "already started"). The cloning steps for -script
elements must set the "already started" flag on - the copy if it is set on the element being cloned.The second is a flag indicating whether the element was - "parser-inserted". Initially,
+script
- elements must have this flag unset. It is set by the HTML - parser and the XML parser onscript
- elements they insert and affects the processing of those - elements.The first is a flag indicating whether or not the script block has been "already + started". Initially,
-script
elements must have this flag unset (script blocks, + when created, are not "already started"). The cloning + steps forscript
elements must set the "already started" flag on the copy if + it is set on the element being cloned.The third is a flag indicating whether the element will - "force-async". Initially,
- -script
elements - must have this flag set. It is unset by the HTML parser - and the XML parser onscript
elements they - insert. In addition, whenever ascript
element whose - "force-async" flag is set has aasync
content attribute added, the - element's "force-async" flag must be unset.The fourth is a flag indicating whether or not the script block is - "ready to be parser-executed". Initially, -
- -script
elements must have this flag unset (script - blocks, when created, are not "ready to be parser-executed"). This - flag is used only for elements that are also - "parser-inserted", to let the parser know when to - execute the script.The last few pieces of state are the script block's - type, the script block's character - encoding, and the script block's fallback - character encoding. They are determined when the script - is prepared, based on the attributes on the element at that time, - and the
+Document
of thescript
- element.The second is a flag indicating whether the element was "parser-inserted". + Initially,
-script
elements must have this flag unset. It is set by the HTML + parser and the XML parser onscript
elements they insert and + affects the processing of those elements.When a
+script
element that is not marked as being - "parser-inserted" experiences one of the events listed - in the following list, the user agent must synchronously prepare thescript
- element:The third is a flag indicating whether the element will "force-async". Initially, +
+ +script
elements must have this flag set. It is unset by the HTML parser + and the XML parser onscript
elements they insert. In addition, whenever + ascript
element whose "force-async" flag is set has aasync
content attribute added, the element's + "force-async" flag must be unset.The fourth is a flag indicating whether or not the script block is "ready to be + parser-executed". Initially,
+ +script
elements must have this flag unset (script + blocks, when created, are not "ready to be parser-executed"). This flag is used only for elements + that are also "parser-inserted", to let the parser know when to execute the + script.The last few pieces of state are the script block's type, the + script block's character encoding, and the script block's fallback character + encoding. They are determined when the script is prepared, based on the attributes on + the element at that time, and the
+ +Document
of thescript
element.When a
script
element that is not marked as being "parser-inserted" + experiences one of the events listed in the following list, the user agent must synchronously + prepare thescript
element:@@ -17067,38 +16951,34 @@ c-end = "-->"
-script
element, after anyscript
elements inserted at that time. -- The
+script
element is in a -Document
and has asrc
attribute set where previously - the element had no such attribute.- The
script
element is in aDocument
and has asrc
attribute set where previously the element had no such + attribute.To prepare a script, the user - agent must act as follows:
+To prepare a script, the user agent must act as + follows:
-
- -
If the
+script
element is marked as having - "already started", then the user agent must abort - these steps at this point. The script is not executed.If the
script
element is marked as having "already started", then + the user agent must abort these steps at this point. The script is not executed.- -
If the element has its "parser-inserted" flag set, - then set was-parser-inserted to true and unset - the element's "parser-inserted" flag. Otherwise, set - was-parser-inserted to false.
+If the element has its "parser-inserted" flag set, then set was-parser-inserted to true and unset the element's + "parser-inserted" flag. Otherwise, set was-parser-inserted to + false.
-This is done so that if parser-inserted -
+script
elements fail to run when the parser tries to - run them, e.g. because they are empty or specify an unsupported - scripting language, another script can later mutate them and cause - them to run again.This is done so that if parser-inserted
@@ -17106,34 +16986,29 @@ c-end = "-->"script
elements fail to run + when the parser tries to run them, e.g. because they are empty or specify an unsupported + scripting language, another script can later mutate them and cause them to run again.- -
If was-parser-inserted is true and the - element does not have an
+async
attribute, then set the - element's "force-async" flag to true.If was-parser-inserted is true and the element does not have an
-async
attribute, then set the element's + "force-async" flag to true.This is done so that if a parser-inserted -
+script
element fails to run when the parser tries to - run it, but it is later executed after a script dynamically - updates it, it will execute asynchronously even if the -async
attribute isn't - set.This is done so that if a parser-inserted
script
element fails to + run when the parser tries to run it, but it is later executed after a script dynamically updates + it, it will execute asynchronously even if theasync
+ attribute isn't set.- -
If the element has no
+src
- attribute, and its child nodes, if any, consist only of comment - nodes and emptyText
nodes, then the user agent must - abort these steps at this point. The script is not executed.If the element has no
src
attribute, and its child + nodes, if any, consist only of comment nodes and emptyText
nodes, then the user + agent must abort these steps at this point. The script is not executed.- -
@@ -17143,140 +17018,116 @@ c-end = "-->"If the element is not in a
+Document
, - then the user agent must abort these steps at this point. The - script is not executed.If the element is not in a
Document
, then the user agent must abort + these steps at this point. The script is not executed.-
-- the
+script
element has atype
attribute and its value is - the empty string, or- the
-script
element has atype
attribute + and its value is the empty string, or- the
+script
element has notype
attribute but it has alanguage
attribute and - that attribute's value is the empty string, or- the
-script
element has notype
attribute + but it has alanguage
attribute and that + attribute's value is the empty string, or- the
+script
element has neither atype
attribute nor alanguage
attribute, then- the
script
element has neither atype
+ attribute nor alanguage
attribute, then...let the script block's type for this -
script
element be "...let the script block's type for this
script
element be "text/javascript
".Otherwise, if the
+ title="attr-script-type">type attribute, let the script block's type for this +script
element has atype
attribute, let the - script block's type for thisscript
element be - the value of that attribute with any leading or trailing sequences - of space characters - removed.script
element be the value of that attribute with any leading or trailing + sequences of space characters removed. -Otherwise, the element has a non-empty
+language
attribute; let - the script block's type for thisscript
- element be the concatenation of the string "text/
" followed by the value of thelanguage
attribute.Otherwise, the element has a non-empty
-language
+ attribute; let the script block's type for thisscript
element be the + concatenation of the string "text/
" followed by the value of thelanguage
attribute.The
+language
attribute is never - conforming, and is always ignored if there is atype
attribute present.The
language
attribute is never + conforming, and is always ignored if there is atype
+ attribute present.- -
If the user agent does not support the scripting - language given by the script block's type for - this
script
element, then the user agent must abort +If the user agent does not support the scripting language given by the + script block's type for this
script
element, then the user agent must abort these steps at this point. The script is not executed.- -
If was-parser-inserted is true, then flag - the element as "parser-inserted" again, and set the - element's "force-async" flag to false.
+If was-parser-inserted is true, then flag the element as + "parser-inserted" again, and set the element's "force-async" flag to + false.
- -
The user agent must set the element's "already - started" flag.
+The user agent must set the element's "already started" flag.
The state of the element at this moment is later used to - determine the script source.
+ href="#establish-script-block-source">is later used to determine the script source.- -
If the element is flagged as "parser-inserted", - but the element's
+Document
is not the -Document
of the parser that created the element, then - abort these steps.If the element is flagged as "parser-inserted", but the element's +
Document
is not theDocument
of the parser that created the element, + then abort these steps.- -
If scripting is - disabled for the
script
element, then the user - agent must abort these steps at this point. The script is not +If scripting is disabled for the
-script
+ element, then the user agent must abort these steps at this point. The script is not executed.The definition of scripting is disabled means - that, amongst others, the following scripts will not execute: - scripts in
+XMLHttpRequest
'sresponseXML
- documents, scripts inDOMParser
-created documents, - scripts in documents created byXSLTProcessor
'stransformToDocument
- feature, and scripts that are first inserted by a script into a -Document
that was created using thecreateDocument()
- API. [XHR] [DOMPARSING] [DOMCORE]The definition of scripting is disabled + means that, amongst others, the following scripts will not execute: scripts in +
XMLHttpRequest
'sresponseXML
+ documents, scripts inDOMParser
-created documents, scripts in documents created by +XSLTProcessor
'stransformToDocument
feature, and scripts + that are first inserted by a script into aDocument
that was created using the +createDocument()
API. [XHR] [DOMPARSING] [DOM]- -
If the
+script
element has anevent
attribute and afor
attribute, then run these - substeps:If the
script
element has anevent
+ attribute and afor
attribute, then run these substeps:-
@@ -17284,16 +17135,14 @@ c-end = "-->"- +
Let for be the value of the
for
attribute.Let for be the value of the
for
+ attribute.- -
Let event be the value of the
event
attribute.- +
Strip leading and trailing whitespace from - event and for.
- -
Strip leading and trailing whitespace from event and + for.
- +
If for is not an ASCII - case-insensitive match for the string "
window
", then the user agent must abort these - steps at this point. The script is not executed.- -
If for is not an ASCII case-insensitive match for the + string "
window
", then the user agent must abort these steps at this + point. The script is not executed.- +
If event is not an ASCII - case-insensitive match for either the string "
onload
" or the string "onload()
", then the user agent must abort these - steps at this point. The script is not executed.If event is not an ASCII case-insensitive match for + either the string "
onload
" or the string "onload()
", then the user agent must abort these steps at this point. The script + is not executed.- -
If the
script
element has acharset
attribute, then let - the script block's character encoding for this +If the
-script
element has acharset
+ attribute, then let the script block's character encoding for thisscript
element be the encoding given by thecharset
attribute.Otherwise, let the script block's fallback character - encoding for this
+script
element be the same as - the encoding of the - document itself.Otherwise, let the script block's fallback character encoding for this +
script
element be the same as the + encoding of the document itself.Only one of these two pieces of state is set.
@@ -17301,8 +17150,8 @@ c-end = "-->"- -
- +If the element has a
+src
- content attribute, run these substeps:If the element has a
src
content attribute, run these + substeps:@@ -17356,124 +17205,102 @@ c-end = "-->"
- -
Then, the first of the following options that describes the - situation must be followed:
+Then, the first of the following options that describes the situation must be followed:
-
@@ -17513,49 +17337,39 @@ c-end = "-->"- If the element has a
+src
attribute, and the element has - adefer
attribute, and the - element has been flagged as "parser-inserted", and - the element does not have anasync
attribute- If the element has a
src
+ attribute, and the element has adefer
attribute, and + the element has been flagged as "parser-inserted", and the element does not have + anasync
attribute- -
-The element must be added to the end of the list of - scripts that will execute when the document has finished - parsing associated with the
+Document
of the - parser that created the element.The element must be added to the end of the list of scripts that will execute when the + document has finished parsing associated with the
-Document
of the parser + that created the element.The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must set the element's - "ready to be parser-executed" flag. The parser will - handle executing the script.
+The task that the networking task source + places on the task queue once the fetching algorithm + has completed must set the element's "ready to be parser-executed" flag. The + parser will handle executing the script.
- If the element has a -
src
attribute, and the - element has been flagged as "parser-inserted", and - the element does not have anIf the element has a
src
attribute, and the element has been flagged as + "parser-inserted", and the element does not have anasync
attribute- -
-The element is the pending parsing-blocking - script of the
+Document
of the parser that - created the element. (There can only be one such script per -Document
at a time.)The element is the pending parsing-blocking script of the +
-Document
of the parser that created the element. (There can only be one such + script perDocument
at a time.)The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must set the element's - "ready to be parser-executed" flag. The parser will - handle executing the script.
+The task that the networking task source + places on the task queue once the fetching algorithm + has completed must set the element's "ready to be parser-executed" flag. The + parser will handle executing the script.
- If the element does not - have a
+src
attribute, and - the element has been flagged as "parser-inserted", - and either the parser that created thescript
is an - XML parser or it's an HTML parser whose - script nesting level is not greater than one, and the -Document
of the HTML parser or - XML parser that created thescript
- element has a style sheet that is blocking - scripts- If the element does not have a
src
attribute, and the element has been flagged as + "parser-inserted", and either the parser that created thescript
is + an XML parser or it's an HTML parser whose script nesting + level is not greater than one, and theDocument
of the HTML + parser or XML parser that created thescript
element has + a style sheet that is blocking scripts- -
The element is the pending parsing-blocking - script of the
+Document
of the parser that - created the element. (There can only be one such script per -Document
at a time.)The element is the pending parsing-blocking script of the +
-Document
of the parser that created the element. (There can only be one such + script perDocument
at a time.)Set the element's "ready to be parser-executed" - flag. The parser will handle executing the script.
+Set the element's "ready to be parser-executed" flag. The parser will handle + executing the script.
- If the element has a
+ title="attr-script-src">src attribute, does not have ansrc
attribute, does not have an -async
attribute, and does - not have the "force-async" flag setasync
attribute, and does not have the + "force-async" flag set- -
-The element must be added to the end of the list of - scripts that will execute in order as soon as possible - associated with the
+Document
of the -script
element at the time the prepare a - script algorithm started.The element must be added to the end of the list of scripts that will execute in order + as soon as possible associated with the
-Document
of thescript
+ element at the time the prepare a script algorithm started.The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must run the following steps:
+The task that the networking task source + places on the task queue once the fetching algorithm + has completed must run the following steps:
-
@@ -17481,30 +17308,27 @@ c-end = "-->"- +
If the element is not now the first element in the - list of scripts that will execute in order as soon as - possible to which it was added above, then mark the - element as ready but abort these steps without executing the - script yet.
- -
If the element is not now the first element in the list of scripts that will + execute in order as soon as possible to which it was added above, then mark the + element as ready but abort these steps without executing the script yet.
Execution: Execute the script block - corresponding to the first script element in this list of - scripts that will execute in order as soon as +
- -
Execution: Execute the script block corresponding to the first + script element in this list of scripts that will execute in order as soon as possible.
- +
Remove the first element from this list of scripts - that will execute in order as soon as possible.
- -
Remove the first element from this list of scripts that will execute in order as + soon as possible.
If this list of scripts that will execute in order - as soon as possible is still not empty and the first - entry has already been marked as ready, then jump back to the +
If this list of scripts that will execute in order as soon as possible is + still not empty and the first entry has already been marked as ready, then jump back to the step labeled execution.
- If the element has a
+src
attribute- If the element has a
src
+ attribute- -
The element must be added to the set of scripts that - will execute as soon as possible of the -
+Document
of thescript
element at the - time the prepare a script algorithm started.The element must be added to the set of scripts that will execute as soon as + possible of the
-Document
of thescript
element at the time the + prepare a script algorithm started.The task that the - networking task source places on the task - queue once the fetching - algorithm has completed must execute the script - block and then remove the element from the set of - scripts that will execute as soon as possible.
+The task that the networking task source + places on the task queue once the fetching algorithm + has completed must execute the script block and then remove the element from the + set of scripts that will execute as soon as possible.
- Otherwise
-- The user agent must immediately execute the script - block, even if other scripts are already executing.
+- The user agent must immediately execute the script block, even if other + scripts are already executing.
Fetching an external script must delay the load - event of the element's document until the task that is queued by the networking task source once - the resource has been fetched (defined - above) has been run.
- -The pending parsing-blocking script of a -
- -Document
is used by theDocument
's - parser(s).If a
- - - -script
element that blocks a - parser gets moved to anotherDocument
before it would - normally have stopped blocking that parser, it nonetheless continues - blocking that parser until the condition that causes it to be - blocking the parser no longer applies (e.g. if the script is a - pending parsing-blocking script because there was - a style sheet that is blocking scripts when it was - parsed, but then the script is moved to another -Document
before the style sheet loads, the script still - blocks the parser until the style sheets are all loaded, at which - time the script executes and the parser is unblocked).When the user agent is required to execute a script block, it must run the following - steps:
+Fetching an external script must delay the load event of the element's document + until the task that is queued + by the networking task source once the resource has been fetched (defined above) has been run.
+ +The pending parsing-blocking script of a
+ +Document
is used by the +Document
's parser(s).If a
+ + + +script
element that blocks a parser gets moved to another +Document
before it would normally have stopped blocking that parser, it nonetheless + continues blocking that parser until the condition that causes it to be blocking the parser no + longer applies (e.g. if the script is a pending parsing-blocking script because there + was a style sheet that is blocking scripts when it was parsed, but then the script is + moved to anotherDocument
before the style sheet loads, the script still blocks the + parser until the style sheets are all loaded, at which time the script executes and the parser is + unblocked).When the user agent is required to execute a script + block, it must run the following steps:
- -
@@ -17565,67 +17379,55 @@ c-end = "-->"If the element is flagged as "parser-inserted", - but the element's
+Document
is not the -Document
of the parser that created the element, then - abort these steps.If the element is flagged as "parser-inserted", but the element's +
Document
is not theDocument
of the parser that created the element, + then abort these steps.-
- If the load resulted in an error (for example a DNS error, or - an HTTP 404 error)
+- If the load resulted in an error (for example a DNS error, or an HTTP 404 error)
-- +
Executing the script block must just consist of firing a simple event named -
error
at the element.Executing the script block must just consist of firing + a simple event named
error
at the element.- If the load was successful
- -
Executing the script block must consist of running the - following steps. For the purposes of these steps, the script is - considered to be from an external file if, while the - prepare a script algorithm above was running for - this script, the
+script
element had asrc
attribute specified.Executing the script block must consist of running the following steps. For the purposes of + these steps, the script is considered to be from an external file if, while the + prepare a script algorithm above was running for this script, the +
script
element had asrc
attribute + specified.-
- -
Initialize the script block's source - as follows:
+Initialize the script block's source as follows:
-
- If the script is from an external file and the - script block's type is a text-based language
+- If the script is from an external file and the script block's type is a + text-based language
- -
-The contents of that file, interpreted as a Unicode - string, are the script source.
+The contents of that file, interpreted as a Unicode string, are the script source.
-To obtain the Unicode string, the user agent run the - following steps:
+To obtain the Unicode string, the user agent run the following steps:
-
- - -
If the resource's Content - Type metadata, if any, specifies a character - encoding, and the user agent supports that encoding, then - let character encoding be that - encoding, and jump to the bottom step in this series of - steps.
- - -
If the algorithm above set the script block's - character encoding, then let character - encoding be that encoding, and jump to the bottom - step in this series of steps.
For each of the rows in the following table, - starting with the first one and going down, if the file has - as many or more bytes available than the number of bytes in - the first column, and the first bytes of the file match the - bytes given in the first column, then set character encoding to the encoding given in - the cell in the second column of that row, and jump to the - bottom step in this series of steps:
+- + +
If the resource's Content Type metadata, if any, + specifies a character encoding, and the user agent supports that encoding, then let character encoding be that encoding, and jump to the bottom step in this + series of steps.
- + +
If the algorithm above set the script block's character encoding, then + let character encoding be that encoding, and jump to the bottom step + in this series of steps.
- -
For each of the rows in the following table, starting with the first one and going + down, if the file has as many or more bytes available than the number of bytes in the + first column, and the first bytes of the file match the bytes given in the first column, + then set character encoding to the encoding given in the cell in the + second column of that row, and jump to the bottom step in this series of steps:
@@ -17658,56 +17460,49 @@ c-end = "-->" -->
-This step looks for Unicode Byte Order - Marks (BOMs).
+This step looks for Unicode Byte Order Marks (BOMs).
- +
Let character encoding be - the script block's fallback character - encoding.
- -
Let character encoding be the script block's fallback + character encoding.
Convert the file to Unicode using character - encoding, following the rules for doing so given by - the specification for the script block's +
Convert the file to Unicode using character encoding, following the + rules for doing so given by the specification for the script block's type.
- If the script is from an external file and the - script block's type is an XML-based language
+- If the script is from an external file and the script block's type is an + XML-based language
- -
-The external file is the script source. When it is later - executed, it must be interpreted in a manner consistent with - the specification defining the language given by the - script block's type.
+The external file is the script source. When it is later executed, it must be + interpreted in a manner consistent with the specification defining the language given by + the script block's type.
- If the script is inline and the script block's - type is a text-based language
+- If the script is inline and the script block's type is a text-based + language
- -
-The value of the
+text
IDL attribute at the - time the element's "already started" flag was - last set is the script source.The value of the
text
IDL attribute at the time + the element's "already started" flag was last set is the script source.- If the script is inline and the script block's - type is an XML-based language
+- If the script is inline and the script block's type is an XML-based + language
- -
@@ -17718,9 +17513,8 @@ c-end = "-->"The child nodes of the
+script
element at the - time the element's "already started" flag was - last set are the script source.The child nodes of the
script
element at the time the element's + "already started" flag was last set are the script source.Fire a simple event named
+ title="event-beforescriptexecute">beforescriptexecute that bubbles and is cancelable + at thebeforescriptexecute
- that bubbles and is cancelable at thescript
- element.script
element.If the event is canceled, then abort these steps.
@@ -17729,9 +17523,8 @@ c-end = "-->"- @@ -17755,19 +17548,17 @@ c-end = "-->"
If the script is from an external file, then increment the - ignore-destructive-writes counter of the -
script
element'sDocument
. Let neutralized doc be that + ignore-destructive-writes counter of thescript
element's +Document
. Let neutralized doc be thatDocument
.- -
@@ -17781,30 +17572,26 @@ c-end = "-->"Create a - script from the
+script
element node, using - the script block's source, the URL - from which the script was obtained, and the script - block's type.Create a script from the +
script
element node, using the script block's source, the + URL from which the script was obtained, and the script block's + type.If the script came from a resource that was fetched in the steps above, and the resource was CORS-cross-origin, then pass the muted errors flag to the create a script from a node algorithm.
-This is where the script is compiled and - actually executed.
+This is where the script is compiled and actually executed.
- -
Decrement the ignore-destructive-writes - counter of neutralized doc, if it - was incremented in the earlier step.
+Decrement the ignore-destructive-writes counter of neutralized + doc, if it was incremented in the earlier step.
Fire a simple event named
+ title="event-afterscriptexecute">afterscriptexecute that bubbles (but is not + cancelable) at theafterscriptexecute
- that bubbles (but is not cancelable) at the -script
element.script
element.- -
@@ -17819,29 +17606,24 @@ c-end = "-->"If the script is from an external file, fire a simple - event named
+load
at the -script
element.If the script is from an external file, fire a simple event named
-load
at thescript
element.Otherwise, the script is internal; queue a - task to fire a simple event named
load
at thescript
+Otherwise, the script is internal; queue a task to fire a simple + event named
load
at thescript
element.The IDL attributes
+ title="dom-script-defer">src
, The IDL attributessrc
,type
,charset
,defer
, each must - reflect the respective content attributes of the same - name.defer
, each must reflect the respective + content attributes of the same name.The
-crossOrigin
IDL attribute must reflect thecrossorigin
content attribute.The
+async
IDL - attribute controls whether the element will execute asynchronously - or not. If the element's "force-async" flag is set, - then, on getting, theasync
- IDL attribute must return true, and on setting, the - "force-async" flag must first be unset, and then the - content attribute must be removed if the IDL attribute's new value - is false, and must be set to the empty string if the IDL attribute's - new value is true. If the element's "force-async" flag - is not set, the IDL attribute must reflect the -async
content attribute.The
async
IDL attribute controls whether the + element will execute asynchronously or not. If the element's "force-async" flag is + set, then, on getting, theasync
IDL attribute must return + true, and on setting, the "force-async" flag must first be unset, and then the + content attribute must be removed if the IDL attribute's new value is false, and must be set to + the empty string if the IDL attribute's new value is true. If the element's + "force-async" flag is not set, the IDL attribute must reflect + theasync
content attribute.- -
@@ -17864,29 +17645,23 @@ c-end = "-->"Returns the contents of the element, ignoring child nodes that - aren't
+Text
nodes.Returns the contents of the element, ignoring child nodes that aren't
-Text
+ nodes.Can be set, to replace the element's children with the given - value.
+Can be set, to replace the element's children with the given value.
--The IDL attribute
+text
must return a - concatenation of the contents of all theText
nodes - that are children of thescript
element (ignoring any - other nodes such as comments or elements), in tree order. On - setting, it must act the same way as thetextContent
- IDL attribute.The IDL attribute
text
must return a + concatenation of the contents of all theText
nodes that are children of the +script
element (ignoring any other nodes such as comments or elements), in tree + order. On setting, it must act the same way as thetextContent
IDL attribute.When inserted using the
+document.write()
method, -script
elements execute (typically synchronously), but - when inserted usinginnerHTML
andouterHTML
attributes, they do not - execute at all.When inserted using the
document.write()
+ method,script
elements execute (typically synchronously), but when inserted using +innerHTML
andouterHTML
+ attributes, they do not execute at all.-In this example, two
+script
elements are used. One - embeds an external script, and the other includes some data.In this example, two
script
elements are used. One embeds an external script, and + the other includes some data.<script src="game-engine.js"></script> <script type="text/x-game-map"> @@ -17896,22 +17671,19 @@ o............A....e .A..AAA...AAAAA...e </script>-The data in this case might be used by the script to generate - the map of a video game. The data doesn't have to be used that way, - though; maybe the map data is actually embedded in other parts of - the page's markup, and the data block here is just used by the - site's search engine to help users who are looking for particular - features in their game maps.
+The data in this case might be used by the script to generate the map of a video game. The + data doesn't have to be used that way, though; maybe the map data is actually embedded in other + parts of the page's markup, and the data block here is just used by the site's search engine to + help users who are looking for particular features in their game maps.
-The following sample shows how a script element can be used to - define a function that is then used by other parts of the - document. It also shows how a
+script
element can be - used to invoke script while the document is being parsed, in this - case to initialize the form's output.The following sample shows how a script element can be used to define a function that is then + used by other parts of the document. It also shows how a
script
element can be used + to invoke script while the document is being parsed, in this case to initialize the form's + output.<script> function calculate(form) { @@ -23869,15 +23641,13 @@ wormhole connection.</mark></p>- Uses
-HTMLElement
.The
+ruby
element allows one or more spans of - phrasing content to be marked with ruby annotations. Ruby - annotations are short runs of text presented alongside base text, - primarily used in East Asian typography as a guide for - pronunciation or to include other annotations. In Japanese, this - form of typography is also known as furigana.The
-ruby
element allows one or more spans of phrasing content to be marked with + ruby annotations. Ruby annotations are short runs of text presented alongside base text, primarily + used in East Asian typography as a guide for pronunciation or to include other annotations. In + Japanese, this form of typography is also known as furigana.The content model of
+ruby
elements consists of one - or more of the following sequences:The content model of
ruby
elements consists of one or more of the following + sequences:
- One or the other of the following: @@ -23894,16 +23664,14 @@ wormhole connection.</mark></p> -
The
+ruby
andrt
elements can be used - for a variety of kinds of annotations, including in particular those - described below. For more details on Japanese Ruby in particular, - and how to render Ruby for Japanese, see Requirements for - Japanese Text Layout. [JLREQ]The
-ruby
andrt
elements can be used for a variety of kinds of + annotations, including in particular those described below. For more details on Japanese Ruby in + particular, and how to render Ruby for Japanese, see Requirements for Japanese Text + Layout. [JLREQ]At the time of writing, CSS does not yet provide a - way to fully control the rendering of the HTML
+ruby
- element. It is hoped that CSS will be extended to support the styles - described below in due course.At the time of writing, CSS does not yet provide a way to fully control the + rendering of the HTML
@@ -23934,11 +23702,10 @@ wormhole connection.</mark></p>ruby
element. It is hoped that CSS will be extended to support + the styles described below in due course.- -
This is similar to the previous case: each ideographic - character in the compound word (the base text) has its reading - given in hiragana or katakana characters (the ruby annotation). - The difference is that the base text segments form a compound word - rather than being separate from each other. +
This is similar to the previous case: each ideographic character in the compound word (the + base text) has its reading given in hiragana or katakana characters (the ruby annotation). The + difference is that the base text segments form a compound word rather than being separate from + each other.
<ruby>B<rt>annotation</rt>B<rt>annotation</ruby>@@ -23959,11 +23726,9 @@ wormhole connection.</mark></p>- -
@@ -23986,9 +23751,8 @@ wormhole connection.</mark></p>This is semantically identical to the previous case (each - individual ideographic character in the base compound word has its - reading given in an annotation in hiragana or katakana - characters), but the rendering is the more complicated Jukugo Ruby - rendering. +
This is semantically identical to the previous case (each individual ideographic character in + the base compound word has its reading given in an annotation in hiragana or katakana + characters), but the rendering is the more complicated Jukugo Ruby rendering.
This is the same example as above for mono-ruby for compound words. The different rendering is expected to be achieved using different styling (e.g. in CSS), and is not shown here.
@@ -23975,9 +23740,9 @@ wormhole connection.</mark></p>For more details on Jukugo - Ruby rendering, see Appendix F in the Requirements for - Japanese Text Layout. [JLREQ]
+ href="http://www.w3.org/TR/jlreq/#positioning_of_jukugoruby">Jukugo Ruby rendering, see + Appendix F in the Requirements for Japanese Text Layout. [JLREQ]- -
The annotation describes the meaning of the base text, rather - than (or in addition to) the pronunciation. As such, both the base - text and the annotation can be multiple characters long. +
The annotation describes the meaning of the base text, rather than (or in addition to) the + pronunciation. As such, both the base text and the annotation can be multiple characters long.
<ruby>BASE<rt>annotation</ruby>@@ -24013,11 +23777,10 @@ wormhole connection.</mark></p>- -
A phonetic reading that corresponds to multiple base - characters, because a one-to-one mapping would be difficult. (In - English, the words "Colonel" and "Lieutenant" are examples of - words where a direct mapping of pronunciation to individual - letters is, in some dialects, rather unclear.) +
A phonetic reading that corresponds to multiple base characters, because a one-to-one mapping + would be difficult. (In English, the words "Colonel" and "Lieutenant" are examples of words + where a direct mapping of pronunciation to individual letters is, in some dialects, rather + unclear.)
In this example, the name of a species of flowers has a phonetic reading provided using group ruby: @@ -24060,54 +23823,42 @@ wormhole connection.</mark></p>
-Within a
- -ruby
element that does not have a -ruby
element ancestor, content is segmented and - segments are placed into three categories: base text segments, - annotation segments, and ignored segments. Ignored segments do not - form part of the document's semantics (they consist of some - inter-element whitespace andrp
elements, - the latter of which are used for legacy user agents that do not - support ruby at all). Base text segments can overlap (with a limit - of two segments overlapping any one position in the DOM, and with - any segment having an earlier start point than an overlapping - segment also having an equal or later end point, and any segment - have a later end point than an overlapping segment also having an - equal or earlier start point). Annotation - segments correspond tort
elements. Each annotation - segment can be associated with a base text segment, and each base - text segment can have annotation segments associated with it. (In a - conforming document, each base text segment is associated with at - least one annotation segment, and each annotation segment is - associated with one base text segment.) Aruby
element - represents the union of the segments of base text it - contains, along with the mapping from those base text segments to - annotation segments. Segments are described in terms of DOM ranges; - annotation segment ranges always consist of exactly one element. [DOMCORE]At any particular time, the segmentation and categorisation of - content of a
+ruby
element is the result that would be - obtained from running the following algorithm:Within a
+ +ruby
element that does not have aruby
element ancestor, + content is segmented and segments are placed into three categories: base text segments, annotation + segments, and ignored segments. Ignored segments do not form part of the document's semantics + (they consist of some inter-element whitespace andrp
elements, the + latter of which are used for legacy user agents that do not support ruby at all). Base text + segments can overlap (with a limit of two segments overlapping any one position in the DOM, and + with any segment having an earlier start point than an overlapping segment also having an equal or + later end point, and any segment have a later end point than an overlapping segment also having an + equal or earlier start point). Annotation segments correspond tort
elements. Each annotation + segment can be associated with a base text segment, and each base text segment can have annotation + segments associated with it. (In a conforming document, each base text segment is associated with + at least one annotation segment, and each annotation segment is associated with one base text + segment.) Aruby
element represents the union of the segments of base + text it contains, along with the mapping from those base text segments to annotation segments. + Segments are described in terms of DOM ranges; annotation segment ranges always consist of exactly + one element. [DOM]At any particular time, the segmentation and categorisation of content of a
ruby
+ element is the result that would be obtained from running the following algorithm:-
-- +
Let base text segments be an empty list - of base text segments, each potentially with a list of base text - subsegments.
- -
Let base text segments be an empty list of base text segments, each + potentially with a list of base text subsegments.
- +
Let annotation segments be an empty list - of annotation segments, each potentially being associated with a - base text segment or subsegment.
- -
Let annotation segments be an empty list of annotation segments, each + potentially being associated with a base text segment or subsegment.
- +
Let root be the
ruby
- element for which the algorithm is being run.- -
Let root be the
ruby
element for which the algorithm is + being run.- +
If root has a
ruby
element - ancestor, then jump to the step labeled end.- -
If root has a
ruby
element ancestor, then jump to the + step labeled end.- +
Let current parent be root.
Let current parent be root.
- @@ -24118,205 +23869,173 @@ wormhole connection.</mark></p>
Let index be 0.
- - + -
Let current base text be null.
Start mode: If index is equal to - or greater than the number of child nodes in current - parent, then jump to the step labeled end mode.
+Start mode: If index is equal to or greater than the number of + child nodes in current parent, then jump to the step labeled end + mode.
-If the indexth node in current parent is an
rt
or -rp
element, jump to the step labeled annotation +- - + -
If the indexth node in current parent is an +
rt
orrp
element, jump to the step labeled annotation mode.- - -
Set start index to the value of index.
- - -
Base mode: If the indexth node in - current parent is a
ruby
element, - and if current parent is the same element as - root, then push a ruby level and - then jump to the step labeled start mode.- +
If the indexth node in current parent is an
rt
or -rp
element, then set the current base - text and then jump to the step labeled annotation - mode.- + +
Set start index to the value of index.
- + +
Base mode: If the indexth node in current + parent is a
ruby
element, and if current parent is the + same element as root, then push a ruby level and then jump to + the step labeled start mode.If the indexth node in current parent is an +
rt
orrp
element, then set the current base text and then + jump to the step labeled annotation mode.- -
Increment index by one.
- +
Base mode post-increment: If index is equal to or greater than the number of - child nodes in current parent, then jump to the - step labeled end mode.
Base mode post-increment: If index is equal to or greater than + the number of child nodes in current parent, then jump to the step labeled + end mode.
- -
Jump back to the step labeled base mode.
- +
Annotation mode: If the indexth - node in current parent is an
rt
- element, then push a ruby annotation and jump to the - step labeled annotation mode increment.- -
Annotation mode: If the indexth node in current + parent is an
rt
element, then push a ruby annotation and jump to + the step labeled annotation mode increment.- +
If the indexth node in current parent is an
rp
element, jump - to the step labeled annotation mode increment.- -
If the indexth node in current parent is an +
rp
element, jump to the step labeled annotation mode increment.- +
If the indexth node in current parent is not a
Text
node, or - is aText
node that is not inter-element - whitespace, then jump to the step labeled base - mode.- -
If the indexth node in current parent is not a +
Text
node, or is aText
node that is not inter-element + whitespace, then jump to the step labeled base mode.- +
Annotation mode increment: Let lookahead index be index plus - one.
- -
Annotation mode increment: Let lookahead index be index plus one.
Annotation mode white-space skipper: If lookahead index is equal to the number of child - nodes in current parent then jump to the step +
- -
Annotation mode white-space skipper: If lookahead index is + equal to the number of child nodes in current parent then jump to the step labeled end mode.
- - -
If the lookahead indexth node in current parent is an
rt
element or an -rp
element, then set index to lookahead index and jump to the step labeled - annotation mode.- - -
If the lookahead indexth node in current parent is not a
Text
node, or - is aText
node that is not inter-element - whitespace, then jump to the step labeled base mode - (without further incrementing index, so the - inter-element whitespace seen so far becomes part of - the next base text segment).- +
Increment lookahead index by - one.
- + +
If the lookahead indexth node in current parent is + an
rt
element or anrp
element, then set index to + lookahead index and jump to the step labeled annotation mode.- -
If the lookahead indexth node in current parent is + not a
Text
node, or is aText
node that is not inter-element + whitespace, then jump to the step labeled base mode (without further incrementing + index, so the inter-element whitespace seen so far becomes part + of the next base text segment).- +
Jump to the step labeled annotation mode white-space - skipper.
- +
Increment lookahead index by one.
- -
Jump to the step labeled annotation mode white-space skipper.
End mode: If current parent is - not the same element as root, then pop a - ruby level and jump to the step labeled base mode + +
- -
End mode: If current parent is not the same element as root, then pop a ruby level and jump to the step labeled base mode post-increment.
- +
End: Return base text segments - and annotation segments. Any content of the -
ruby
element not described by segments in either of - thost lists is implicitly in an ignored segment.End: Return base text segments and annotation + segments. Any content of the
ruby
element not described by segments in either + of thost lists is implicitly in an ignored segment.When the steps above say to set the current base text, - it means to run the following steps at that point in the - algorithm:
+When the steps above say to set the current base text, it means to run the following + steps at that point in the algorithm:
-
- + title="concept-range-start">start is the boundary + point (current parent, start index) and whose + end is the boundary + point (current parent, index). -
Let text range a DOM range whose start is the boundary point (current parent, start index) and - whose end is the boundary point (current parent, index).
Let new text segment be a base text - segment described by the range annotation - range.
+Let new text segment be a base text segment described by the range + annotation range.
-- +
Add new text segment to base text segments.
- -
Add new text segment to base text + segments.
- +
Let current base text be new text segment.
Let current base text be new text + segment.
Let start index be null.
When the steps above say to push a ruby level, it - means to run the following steps at that point in the algorithm:
+When the steps above say to push a ruby level, it means to run the following steps + at that point in the algorithm:
-
-- +
Let current parent be the indexth node in current - parent.
Let current parent be the indexth node in current parent.
- -
Let index be 0.
- +
Set saved start index to the value of - start index.
Set saved start index to the value of start + index.
Let start index be null.
When the steps above say to pop a ruby level, it means - to run the following steps at that point in the algorithm:
+When the steps above say to pop a ruby level, it means to run the following steps at + that point in the algorithm:
-
-- +
Let index be the position of current parent in root.
- -
Let index be the position of current parent in + root.
- +
Let current parent be root.
Let current parent be root.
- -
Increment index by one.
- +
Set start index to the value of - saved start index.
Set start index to the value of saved start + index.
Let saved start index be null.
When the steps above say to push a ruby annotation, it - means to run the following steps at that point in the algorithm:
+When the steps above say to push a ruby annotation, it means to run the following + steps at that point in the algorithm:
-
@@ -24325,9 +24044,8 @@ wormhole connection.</mark></p> -- +
Let rt be the
rt
element - that is the indexth node of current parent.- -
Let rt be the
rt
element that is the indexth node of current parent.- +
Let annotation range a DOM range whose - start is the boundary point (current parent, index) and whose - end is the boundary point (current parent, index plus one) - (i.e. that contains only rt).
- -
Let annotation range a DOM range whose start is the boundary + point (current parent, index) and whose end is the boundary point + (current parent, index plus one) (i.e. that contains only + rt).
- +
Let new annotation segment be an - annotation segment described by the range annotation - range.
- -
Let new annotation segment be an annotation segment described by the + range annotation range.
- +
If current base text is not null, - associate new annotation segment with current base text.
- -
If current base text is not null, associate new + annotation segment with current base text.
- +
Add new annotation segment to annotation segments.
Add new annotation segment to annotation + segments.
In this example, each ideograph in the Japanese text 漢字 is annotated with its - reading in hiragana.
+In this example, each ideograph in the Japanese text 漢字 is annotated with its reading in hiragana.
... <ruby>漢<rt>かん</rt>字<rt>じ</rt></ruby> @@ -24344,9 +24062,8 @@ wormhole connection.</mark></p>-In this example, each ideograph in the traditional Chinese text - 漢字 is annotated - with its bopomofo reading.
+In this example, each ideograph in the traditional Chinese text 漢字 is annotated with its bopomofo reading.
<ruby>漢<rt>ㄏㄢˋ</rt>字<rt>ㄗˋ</rt></ruby>@@ -24361,9 +24078,8 @@ wormhole connection.</mark></p> -In this example, each ideograph in the simplified Chinese text - 汉字 is annotated - with its pinyin reading.
+In this example, each ideograph in the simplified Chinese text 汉字 is annotated with its pinyin reading.
...<ruby>汉<rt>hàn</rt>字<rt>zì</rt></ruby>...@@ -24378,11 +24094,10 @@ wormhole connection.</mark></p>-@@ -28325,6 +28032,10 @@ href="?audio">audio</a> test instead.)</p> +In this more contrived example, the acronym "HTML" has four - annotations: one for the whole acronym, briefly describing what it - is, one for the letters "HT" expanding them to "Hypertext", one for - the letter "M" expanding it to "Markup", and one for the letter "L" - expanding it to "Language".
+In this more contrived example, the acronym "HTML" has four annotations: one for the whole + acronym, briefly describing what it is, one for the letters "HT" expanding them to "Hypertext", + one for the letter "M" expanding it to "Markup", and one for the letter "L" expanding it to + "Language".
<ruby> <ruby>HT<rt>Hypertext</rt>M<rt>Markup</rt>L<rt>Language</rt></ruby> @@ -26536,30 +26251,22 @@ interface HTMLImageElement : HTMLElement {Otherwise, the attribute must return false.
-The value of
- -complete
can thus change while a - script is executing.Three constructors are provided for creating -
+HTMLImageElement
objects (in addition to the factory - methods from DOM Core such ascreateElement()
):Image()
,Image(width)
, andImage(width, height)
. When invoked as constructors, - these must return a newHTMLImageElement
object (a new -img
element). If the width argument - is present, the new object'swidth
content attribute must be set to - width. If the height - argument is also present, the new object'sheight
content attribute must be set - to height. The element's document must be the - active document of the browsing context of - theWindow
object on which the interface object of the - invoked constructor is found.The value of
+ +complete
can thus change while + a script is executing.Three constructors are provided for creating
HTMLImageElement
objects (in addition + to the factory methods from DOM such ascreateElement()
):Image()
,Image(width)
, andImage(width, height)
. When invoked as constructors, + these must return a newHTMLImageElement
object (a newimg
element). If + the width argument is present, the new object'swidth
content attribute must be set to width. If + the height argument is also present, the new object'sheight
content attribute must be set to height. + The element's document must be the active document of the browsing + context of theWindow
object on which the interface object of the invoked + constructor is found.- +
The nested browsing context's
Window
object's + cross-boundary event parent is the browsing context container. [DOM]If the attribute is not specified, or if the origin conditions listed above are @@ -30133,26 +29844,19 @@ interface HTMLAudioElement : HTMLMediaElement {};
-@@ -40453,7 +40157,7 @@ interface HTMLCanvasElement : HTMLElement { though the element itself is not visible). This allows authors to make an interactive canvas keyboard-accessible: authors should have a one-to-one mapping of interactive regions to focusable elements in the fallback content. (Focus has no effect on mouse interaction events.) - [DOMEVENTS] + [DOMEVENTS]Two constructors are provided for creating -
+HTMLAudioElement
objects (in addition to the factory - methods from DOM Core such ascreateElement()
):Audio()
andAudio(src)
. When invoked as constructors, - these must return a newHTMLAudioElement
object (a new -audio
element). The element must have itspreload
attribute set to the - literal value "auto
". If the src argument is present, the object created must have - itssrc
content attribute set to - the provided value, and the user agent must invoke the object's - resource selection - algorithm before returning. The element's document must be - the active document of the browsing - context of theWindow
object on which the - interface object of the invoked constructor is found.Two constructors are provided for creating
HTMLAudioElement
objects (in addition + to the factory methods from DOM such ascreateElement()
):Audio()
andAudio(src)
. When invoked as constructors, these must return a new +HTMLAudioElement
object (a newaudio
element). The element must have its +preload
attribute set to the literal value "auto
". If the src argument is present, + the object created must have itssrc
content attribute set to + the provided value, and the user agent must invoke the object's resource selection algorithm before returning. The + element's document must be the active document of the browsing context + of theWindow
object on which the interface object of the invoked constructor is + found.
@@ -61205,92 +60909,66 @@ interface HTMLOptionElement : HTMLElement {-@@ -81232,9 +80910,9 @@ State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON OThe
- -disabled
- IDL attribute must reflect the content attribute of the - same name. ThedefaultSelected
- IDL attribute must reflect theselected
content attribute.The
- -label
IDL - attribute, on getting, must return the element's label. On setting, the element's -label
content attribute must - be set to the new value.The
- -value
IDL - attribute, on getting, must return the element's value. On setting, the element's -value
content attribute must - be set to the new value.The
- -selected
- IDL attribute, on getting, must return true if the element's selectedness is true, and - false otherwise. On setting, it must set the element's selectedness to the new - value, and then cause the element to ask for a reset.The
- -index
IDL - attribute must return the element's index.The
- -text
IDL - attribute, on getting, must return the value of the -textContent
IDL attribute on the element, with leading and trailing - whitespace stripped, and with any sequences of two or more - space characters replaced by a - single U+0020 SPACE character. On setting, it must act as if the -textContent
IDL attribute on the element had been set - to the new value.The
- -form
IDL - attribute's behavior depends on whether theoption
- element is in aselect
element or not. If the -option
has aselect
element as its parent, - or has anoptgroup
element as its parent and that -optgroup
element has aselect
element as - its parent, then theform
IDL - attribute must return the same value as theform
IDL attribute on that -select
element. Otherwise, it must return null.Several constructors are provided for creating -
+HTMLOptionElement
objects (in addition to the factory - methods from DOM Core such ascreateElement()
):Option()
,Option(text)
,Option(text, value)
,Option(text, value, defaultSelected)
, andOption(text, value, defaultSelected, selected)
. When invoked as constructors, - these must return a newHTMLOptionElement
object (a new -option
element). If the text - argument is present, the new object must have as its only child a -Text
node whose data is the value of that argument. If - the value argument is present, the new object - must have avalue
attribute - set with the value of the argument as its value. If the defaultSelected argument is present and true, the new - object must have aselected
attribute set with no - value. If the selected argument is present and - true, the new object must have its selectedness set to true; - otherwise the fourth argument is absent or false, and the selectedness must be set - to false, even if the defaultSelected argument - is present and true. The element's document must be the active - document of the browsing context of the -Window
object on which the interface object of the - invoked constructor is found.The
+ +disabled
IDL attribute must + reflect the content attribute of the same name. ThedefaultSelected
IDL attribute must + reflect theselected
content attribute.The
+ +label
IDL attribute, on getting, must + return the element's label. On setting, the element's +label
content attribute must be set to the new value.The
+ +value
IDL attribute, on getting, must + return the element's value. On setting, the element's +value
content attribute must be set to the new value.The
+ +selected
IDL attribute, on getting, + must return true if the element's selectedness is + true, and false otherwise. On setting, it must set the element's selectedness to the new value, and then cause the + element to ask for a reset.The
+ +index
IDL attribute must return the + element's index.The
+ +text
IDL attribute, on getting, must return + the value of thetextContent
IDL attribute on the element, with leading and trailing whitespace stripped, and with any + sequences of two or more space characters replaced by a + single U+0020 SPACE character. On setting, it must act as if thetextContent
IDL + attribute on the element had been set to the new value.The
+ +form
IDL attribute's behavior depends on + whether theoption
element is in aselect
element or not. If the +option
has aselect
element as its parent, or has an +optgroup
element as its parent and thatoptgroup
element has a +select
element as its parent, then theform
IDL + attribute must return the same value as theform
IDL attribute + on thatselect
element. Otherwise, it must return null.Several constructors are provided for creating
HTMLOptionElement
objects (in + addition to the factory methods from DOM such ascreateElement()
):Option()
,Option(text)
,Option(text, value)
,Option(text, value, defaultSelected)
, andOption(text, value, defaultSelected, selected)
. When invoked as constructors, these must return a new +HTMLOptionElement
object (a newoption
element). If the text argument is present, the new object must have as its only child a +Text
node whose data is the value of that argument. If the value + argument is present, the new object must have avalue
+ attribute set with the value of the argument as its value. If the defaultSelected argument is present and true, the new object must have aselected
attribute set with no value. If the selected argument is present and true, the new object must have its selectedness set to true; otherwise the fourth argument + is absent or false, and the selectedness must be + set to false, even if the defaultSelected argument is present and true. The + element's document must be the active document of the browsing context + of theWindow
object on which the interface object of the invoked constructor is + found.When faced with displaying an XML file inline, user agents must first create a
+ recommendations, RFC 3023, DOM, and other relevant specifications. [XML] [XMLNS] [RFC3023] [DOM]Document
object, following the requirements of the XML and Namespaces in XML - recommendations, RFC 3023, DOM Core, and other relevant specifications. [XML] [XMLNS] [RFC3023] [DOMCORE]The actual HTTP headers and other metadata, not the headers as mutated or implied by the algorithms given in this specification, are the ones that must be used when determining the @@ -85907,6 +85585,7 @@ interface NavigatorOnLine { tasks queued with the user interaction task source. [DOMEVENTS]
+ @@ -86109,117 +85788,95 @@ interface NavigatorOnLine { -Many objects can have event handlers specified. These - act as non-capture event listeners for the object on which they are - specified. [DOMCORE]
+Many objects can have event handlers specified. These act as non-capture event + listeners for the object on which they are specified. [DOM]
-An event handler can either - have the value null or be set to a callback object. This is defined - using the
+EventHandler
callback interface type. Initially, event handlers must be set to - null.An event handler can either have the value null or be set + to a callback object. This is defined using the
EventHandler
callback interface type. + Initially, event handlers must be set to null.Event handlers are exposed in one of two ways.
-The first way, common to all event handlers, is as an event handler IDL - attribute.
+The first way, common to all event handlers, is as an event handler IDL attribute.
-The second way is as an event handler content attribute. Event handlers - on HTML elements and some of the event handlers on +
The second way is as an event handler content + attribute. Event handlers on HTML elements and some of the event handlers on
Window
objects are exposed in this way.-
-Event handler IDL attributes, on setting, must set the - corresponding event handler to their new value, and on - getting, must return whatever the current value of the corresponding +
Event handler IDL attributes, on setting, must set the corresponding event handler + to their new value, and on getting, must return whatever the current value of the corresponding event handler is (possibly null).
-If an event handler - IDL attribute exposes an event - handler of an object that doesn't exist, it must always +
If an event handler IDL attribute exposes an + event handler of an object that doesn't exist, it must always return null on getting and must do nothing on setting.
-This can happen in particular for event handler IDL attribute on -
body
elements that do not have corresponding +This can happen in particular for event + handler IDL attribute on
-body
elements that do not have correspondingWindow
objects.Certain event handler IDL attributes have additional - requirements, in particular the
onmessage
attribute of +Certain event handler IDL attributes have additional requirements, in particular + the
-onmessage
attribute ofMessagePort
objects.On getting, event handler IDL attributes must return - the value of their corresponding event handlers, except when the - value is an internal error - value, in which case the user agent must set the corresponding - event handler to null, and then throw an exception corresponding to - the error condition.
+On getting, event handler IDL attributes must return the value of their + corresponding event handlers, except when the value is an internal error value, in which case the user agent must set + the corresponding event handler to null, and then throw an exception corresponding to the error + condition.
Event handler content attributes, when specified, must - contain valid JavaScript code which, when parsed, would match the -
FunctionBody
production after automatic +Event handler content attributes, when specified, must contain valid JavaScript code + which, when parsed, would match the
FunctionBody
production after automatic semicolon insertion. [ECMA262]-When an event - handler content attribute is set, if the element is owned by - a
+Document
that is in a browsing context, - and scripting is enabled for - that browsing context, the user agent must run the - following steps to create a script after setting the content - attribute to its new value:When an event handler content attribute + is set, if the element is owned by a
Document
that is in a browsing + context, and scripting is enabled for that + browsing context, the user agent must run the following steps to create a script after setting the content attribute to its new value:-
-- +
Set the corresponding event - handler to null.
- -
Set the corresponding event handler to null.
- +
Set up a script execution environment for - JavaScript.
- -
Set up a script execution environment for JavaScript.
- +
Let body be the event handler content - attribute's new value.
Let body be the event + handler content attribute's new value.
- -
If body is not parsable as - FunctionBody or if parsing detects an early error - then set the event handler content attribute to an - error as defined below, and abort these steps.
+If body is not parsable as FunctionBody or if parsing detects an + early error then set the event handler content attribute to an error as + defined below, and abort these steps.
-FunctionBody is defined in ECMAScript - edition 5 section 13 Function Definition. Early error is - defined in ECMAScript edition 5 section 16 Errors. FunctionBody is defined in ECMAScript edition 5 section 13 Function + Definition. Early error is defined in ECMAScript edition 5 section 16 Errors. [ECMA262]
- -
@@ -86228,24 +85885,20 @@ interface NavigatorOnLine { currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=11977#c4If body begins with a Directive Prologue - that contains a Use Strict Directive then let strict be true, otherwise let strict be false.
+If body begins with a Directive Prologue that contains a Use Strict + Directive then let strict be true, otherwise let strict + be false.
-The terms "Directive Prologue" and "Use Strict - Directive" are defined in ECMAScript edition 5 section 14.1 - Directive Prologues and the Use Strict Directive. The terms "Directive Prologue" and "Use Strict Directive" are defined in + ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. [ECMA262]
- -
-->If strict is true, and anything in body is a
+SyntaxError
according to the - Strict Mode Restrictions, then set the event handler content - attribute to an error as defined below, and abort these - steps.If strict is true, and anything in body is a +
-SyntaxError
according to the Strict Mode Restrictions, then set the event + handler content attribute to an error as defined below, and abort these steps.The Strict Mode Restrictions are those listed in - ECMAScript edition 5 section 13.1 Strict Mode Restrictions. [ECMA262]
+The Strict Mode Restrictions are those listed in ECMAScript edition 5 section + 13.1 Strict Mode Restrictions. [ECMA262]
- -
-Using the script execution environment created above, create a - function object (as defined in ECMAScript edition 5 section 13.2 - Creating Function Objects), with:
+Using the script execution environment created above, create a function object (as defined in + ECMAScript edition 5 section 13.2 Creating Function Objects), with:
@@ -86255,20 +85908,16 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119
--
@@ -86284,24 +85933,20 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119- If the attribute is the
+onerror
attribute of the -Window
object- If the attribute is the
-onerror
attribute of + theWindow
object- Let the function have four arguments, named
+event
,source
,lineno
, andcolumn
.- Let the function have four arguments, named
event
,source
,lineno
, andcolumn
.- Otherwise
-- Let the function have a single argument called
+event
.- Let the function have a single argument called
event
.-
-- Let Scope be the result of - NewObjectEnvironment(the element's
+Document
, the - global environment).- Let Scope be the result of NewObjectEnvironment(the element's +
-Document
, the global environment).- If the element has a form owner, let Scope be the result of NewObjectEnvironment(the - element's form owner, If the element has a form owner, let Scope be the result + of NewObjectEnvironment(the element's form owner, Scope).
-- Let Scope be the result of - NewObjectEnvironment(the element's object, Scope).
+- Let Scope be the result of NewObjectEnvironment(the element's object, + Scope).
NewObjectEnvironment() is defined in ECMAScript - edition 5 section 10.2.2.3 NewObjectEnvironment (O, E). [ECMA262]
+NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3 + NewObjectEnvironment (O, E). [ECMA262]
@@ -86311,37 +85956,31 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119Let this new function be the only entry in the script's - list of code entry-points.
+Let this new function be the only entry in the script's list of code + entry-points.
Set up the script's global object, the - script's browsing context, the script's - document, the script's referrer source, the - script's URL character encoding, and the - script's base URL from the script settings - determined from the node on which the attribute is being +
- -
Set up the script's global object, the script's browsing + context, the script's document, the script's referrer source, + the script's URL character encoding, and the script's base URL from + the script settings determined from the node on which the attribute is being set.
- +
Set the corresponding event - handler to the aforementioned function.
Set the corresponding event handler to the + aforementioned function.
When a user agent is required, by the steps above, to set - the event handler content attribute to an error, the user - agent must set the corresponding event - handler to an internal - error value representing the error condition, keeping track of - the URL of the resource where the event handler content attribute - was set, and the relevant line number inside that resource where the - error occurred.
- -When an event handler content attribute is removed, the user - agent must set the corresponding event - handler to null.
+When a user agent is required, by the steps above, to set the event handler content + attribute to an error, the user agent must set the corresponding event handler to an internal error value + representing the error condition, keeping track of the URL of the resource where the + event handler content attribute was set, and + the relevant line number inside that resource where the error occurred.
+ +When an event handler content attribute is removed, the user agent must set the corresponding + event handler to null.
@@ -86362,46 +85999,36 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119
-When an event handler H of an element or object T - implementing the
- -EventTarget
interface is first set to - a non-null value, the user agent must append an event listener to the list of - event listeners - associated with T with type set to the - event handler event type corresponding to H, capture set to false, and listener - set to the event handler processing algorithm defined - below. [DOMCORE]The listener is emphatically not the - event handler itself. Every - event handler ends up registering the same listener, the - algorithm defined below, which takes care of invoking the right - callback, and processing the callback's return value.
- -This only happens the first time the event handler's value is set. Since - listeners are called in the order they were registered, the order of - event listeners for a particular event type will always be first the - event listeners registered with
+addEventListener()
- before the first time the event - handler was set to a non-null value, then the callback to - which it is currently set, if any, and finally the event listeners - registered withaddEventListener()
- after the first time the event - handler was set to a non-null value.When an event handler H of an element + or object T implementing the
+ +EventTarget
interface is first set + to a non-null value, the user agent must append an event + listener to the list of event listeners + associated with T with type set to the event handler event + type corresponding to H, capture set to false, and + listener set to the event handler processing algorithm defined below. [DOM]The listener is emphatically not the event handler itself. Every event handler ends up registering the same + listener, the algorithm defined below, which takes care of invoking the right callback, and + processing the callback's return value.
+ +This only happens the first time the event + handler's value is set. Since listeners are called in the order they were registered, the + order of event listeners for a particular event type will always be first the event listeners + registered with
addEventListener()
before + the first time the event handler was set to a non-null value, + then the callback to which it is currently set, if any, and finally the event listeners registered + withaddEventListener()
after the + first time the event handler was set to a non-null value.-This example demonstrates the order in which event listeners are - invoked. If the button in this example is clicked by the user, the - page will show four alerts, with the text "ONE", "TWO", "THREE", - and "FOUR" respectively.
+This example demonstrates the order in which event listeners are invoked. If the button in + this example is clicked by the user, the page will show four alerts, with the text "ONE", "TWO", + "THREE", and "FOUR" respectively.
<button id="test">Start Demo</button> <script> @@ -86417,19 +86044,16 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119-The interfaces implemented by the event object do - not influence whether an event - handler is triggered or not.
+The interfaces implemented by the event object do not influence whether an event handler is triggered or not.
-The event handler processing algorithm for an - event handler H and an
+Event
object E is as follows:The event handler processing algorithm for an event + handler H and an
Event
object E is as + follows:-
- +
If H's value is null, then abort these - steps.
If H's value is null, then abort these steps.
- -
If H's value is an internal error value, then set the event handler to null and then @@ -86439,18 +86063,14 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119 handlers">event handler of the
Window
object of thatDocument
, and abort these steps.- +
Let callback be H's - value, the callback that the event - handler was last set to.
- -
Let callback be H's value, the callback that the + event handler was last set to.
- +
Invoke callback with one - argument, the value of which is the
Event
object E, with the callback this value set to - E'scurrentTarget
. Let the - return value be return value. [WEBIDL]Invoke callback with one argument, the value of which is the +
Event
object E, with the callback this value set to E'scurrentTarget
. Let the return value be return value. [WEBIDL]- @@ -86458,26 +86078,24 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119
-
- If the event type is
+mouseover
- If the event type is
-mouseover
- +
If return value is a boolean with the - value true, then cancel the event.
- -
If return value is a boolean with the value true, then cancel the + event.
- If the
+Event
object E is a -BeforeUnloadEvent
object- If the
-Event
object E is aBeforeUnloadEvent
+ objectIf return value is a string, and the -
Event
object E'sreturnValue
+- + title="dom-BeforeUnloadEvent-returnValue">returnValue attribute's value to return value.
If return value is a string, and the
Event
object E'sreturnValue
attribute's value is the empty string, then set thereturnValue
- attribute's value to return value.- Otherwise
-- +
If return value is a boolean with the - value false, then cancel the event.
- @@ -86491,16 +86109,14 @@ currently this is unnecessary: http://www.w3.org/Bugs/Public/show_bug.cgi?id=119
If return value is a boolean with the value false, then cancel the + event.
-The
+EventHandler
interface represents a callback - used for event handlers. It is represented in Web IDL as - follows:The
EventHandler
interface represents a callback used for event handlers. It is + represented in Web IDL as follows:[TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event); typedef EventHandlerNonNull? EventHandler;-In JavaScript, any
+Function
object - implements this interface.In JavaScript, any
Function
object implements this interface.@@ -86508,24 +86124,19 @@ typedef EventHandlerNonNull? EventHandler;-<body onload="alert(this)" onclick="alert(this)">-...leads to an alert saying "
+[object Window]
" when the document is loaded, - and an alert saying "[object HTMLBodyElement]
" whenever the user - clicks something in the page....leads to an alert saying "
[object Window]
" when the document is + loaded, and an alert saying "[object HTMLBodyElement]
" whenever the + user clicks something in the page.The return value of the function affects whether the - event is canceled or not: as described - above, if the return value is false, the event is canceled - (except for
+mouseover
events, - where the return value has to be true to cancel the event). With -beforeunload
events, the - value is instead used to determine the message to show the user.The return value of the function affects whether the event is canceled or not: + as described above, if the return value is false, the event is canceled + (except for
-mouseover
events, where the return value has to + be true to cancel the event). Withbeforeunload
events, + the value is instead used to determine the message to show the user.For historical reasons, the
onerror
handler has different +For historical reasons, the
onerror
handler has different arguments:[TreatNonCallableAsNull] @@ -86537,12 +86148,10 @@ typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;Event handlers on elements,
-Document
objects, andWindow
objectsThe following are the event handlers (and their - corresponding event handler - event types) that must be supported - by all HTML elements, as both content attributes and - IDL attributes, and on
+Document
andWindow
- objects, as IDL attributes.The following are the event handlers (and their corresponding event handler event types) that must be + supported by all HTML elements, as both content attributes and IDL attributes, and on +
Document
andWindow
objects, as IDL attributes.@@ -86736,14 +86345,16 @@ typedef OnErrorEventHandlerNonNull? OnErrorEventHandler;
Events and the
-Window
objectWhen an event is dispatched at a DOM node in a -
+Document
in a browsing context, if the - event is not aload
event, the user - agent must act as if, for the purposes of event dispatching, the -Window
object is the parent of the -Document
object. [DOMCORE]When an event is dispatched at a DOM node in a
+ + @@ -95429,9 +95040,9 @@ interface WorkerUtils { href="#refsHTML">[HTML] -Document
in a browsing + context, if the event is not aload
event, the user agent + must act as if, for the purposes of event dispatching, + theWindow
object is the parent of theDocument
object. [DOM]The DOM APIs — specifically, all the interfaces defind in the DOM Core specification - other than exceptions — must not be exposed if the - JavaScript global environment is a worker environment. The DOM APIs — specifically, all the interfaces defind in the DOM specification other + than exceptions — must not be exposed if the JavaScript + global environment is a worker environment. [DOMCORE]
@@ -105237,7 +104848,7 @@ document.body.appendChild(text); title="dom-document-writeln">document.writeln() calls. [DOMEVENTS] -However, mutation observers do fire, as required by the DOM Core specification.
+However, mutation observers do fire, as required by the DOM specification.
Not all of the tag names mentioned below are conformant tag names in this specification; many are included to @@ -110467,45 +110078,39 @@ document.body.appendChild(text);
Parsing XHTML documents
-This section describes the relationship between XML and the DOM, - with a particular emphasis on how this interacts with HTML.
+This section describes the relationship between XML and the DOM, with a particular emphasis on + how this interacts with HTML.
-An XML parser, for the purposes of this specification, - is a construct that follows the rules given in the XML specification - to map a string of bytes or characters into a
+Document
- object.An XML parser, for the purposes of this specification, is a construct that follows + the rules given in the XML specification to map a string of bytes or characters into a +
-Document
object.An XML parser is either associated with a -
+Document
object when it is created, or creates one - implicitly.An XML parser is either associated with a
Document
object when it is + created, or creates one implicitly.This
-Document
must then be populated with DOM nodes that represent the tree structure of the input passed to the parser, as defined by the XML specification, the Namespaces - in XML specification, and the DOM Core specification. DOM mutation events must not fire for the + in XML specification, and the DOM specification. DOM mutation events must not fire for the operations that the XML parser performs on theDocument
's tree, but the user agent must act as if elements and attributes were individually appended and set respectively so as to trigger rules in this specification regarding what happens when an element is inserted - into a document or has its attributes set, and the DOM Core specification's requirements regarding + into a document or has its attributes set, and the DOM specification's requirements regarding mutation observers mean that mutation observers are fired (unlike mutation events). [XML] [XMLNS] [DOMCORE] [XML] [XMLNS] [DOM] [DOMEVENTS]Between the time an element's start tag is parsed and the time - either the element's end tag is parsed or the parser detects a - well-formedness error, the user agent must act as if the element was - in a stack of open elements.
+Between the time an element's start tag is parsed and the time either the element's end tag is + parsed or the parser detects a well-formedness error, the user agent must act as if the element + was in a stack of open elements.
-This is used by the
+object
element to - avoid instantiating plugins before theparam
element - children have been parsed.This is used by the
-object
element to avoid instantiating plugins + before theparam
element children have been parsed.This specification provides the following additional information - that user agents should use when retrieving an external entity: the - public identifiers given in the following list all correspond to the URL given by this - link. (This URL is a DTD containing the entity reference - declarations for the names listed in the named character - references section.)
+This specification provides the following additional information that user agents should use + when retrieving an external entity: the public identifiers given in the following list all + correspond to the URL given by this link. (This + URL is a DTD containing the entity reference declarations for the names listed in the named + character references section.)
- @@ -110711,27 +110316,20 @@ document.body.appendChild(text);
-//W3C//DTD XHTML 1.0 Transitional//EN
- -
@@ -115308,7 +114906,7 @@ if (s = prompt('What is your name?')) {If there is a context element, - feed the parser just created the string corresponding - to the start tag of that element, declaring all the namespace - prefixes that are in scope on that element in the DOM, as well as - declaring the default namespace (if any) that is in scope on that - element in the DOM.
+If there is a context element, feed the + parser just created the string corresponding to the start tag of that element, declaring + all the namespace prefixes that are in scope on that element in the DOM, as well as declaring + the default namespace (if any) that is in scope on that element in the DOM.
-A namespace prefix is in scope if the DOM Core
+lookupNamespaceURI()
method on the element would - return a non-null value for that prefix.A namespace prefix is in scope if the DOM
-lookupNamespaceURI()
method + on the element would return a non-null value for that prefix.The default namespace is the namespace for which the DOM Core -
+isDefaultNamespace()
method on the element - would return true.The default namespace is the namespace for which the DOM
-isDefaultNamespace()
method on the element would return true.If there is a context element, no
+DOCTYPE
is passed to the parser, and therefore no - external subset is referenced, and therefore no entities will be - recognized.If there is a context element, no +
DOCTYPE
is passed to the parser, and therefore no external subset is + referenced, and therefore no entities will be recognized.event
onscript
elements- -
for
onscript
elements- +
Use DOM Events mechanisms to register event listeners. [DOMCORE]
Use DOM Events mechanisms to register event listeners. [DOM]
datapagesize
ontable
elements- @@ -121694,14 +121292,14 @@ if (s = prompt('What is your name?')) {
Unnecessary. Omit it altogether.
- [DASH]
- Dynamic adaptive streaming over HTTP (DASH). ISO.
-- [DOMCORE]
-- Web DOM Core, A. van Kesteren. WHATWG.
+- [DOM]
+- DOM, A. van Kesteren, A. Gregor, Ms2ger. WHATWG.
- [DOMEVENTS]
- Document Object Model (DOM) Level 3 Events Specification, T. Leithead, J. Rossi, D. Schepers, B. Höhrmann, P. Le Hégaret, T. Pixley. W3C.
- [DOMPARSING]
-- DOM Parsing and Serialization, Ms2ger. html5.org.
+- DOM Parsing and Serialization, Ms2ger. WHATWG.
- [DOT]
- (Non-normative) The DOT Language. Graphviz.
@@ -121717,7 +121315,7 @@ if (s = prompt('What is your name?')) {- (Non-normative) ECMAScript for XML (E4X) Specification. ECMA.
- [EDITING]
-- HTML Editing APIs, A. Gregor.
+- HTML Editing APIs, A. Gregor. W3C Editing APIs CG.
- [EUCKR]
- Hangul Unix Environment. Korea Industrial Standards Association. Ref. No. KS C 5861-1992.