diff -r 334b4c11b92f Overview.src.html --- a/Overview.src.html Fri Jan 27 15:52:28 2012 +0100 +++ b/Overview.src.html Wed Feb 08 13:46:25 2012 -0800 @@ -1372,14 +1372,23 @@ increase its end offset by count. -
If node is a DocumentFragment
- node, insert its
- children (preserving
- tree order), before
- child or at the end of parent if
- child is null.
-
-
Otherwise insert node before +
Let addedNodes be an ordered list of nodes. + +
If node is a DocumentFragment
+ node, append its
+ children to addedNodes
+ (preserving tree order);
+ otherwise, append node to addedNodes.
+
+
Dispatch a
+ "childList" mutation with target set to parent,
+ addedNodes set to addedNodes,
+ nextSibling set to child, and previousSibling set to
+ child's previous sibling
+ or to parent's last child
+ if child is null.
+
+
Insert all nodes in addedNodes before child or at the end of parent if child is null. @@ -1567,6 +1576,21 @@ index, decrease its end offset by one. +
Dispatch a
+ "childList" mutation with target set to parent,
+ removedNodes set to a NodeList containing only node,
+ nextSibling set to node's
+ next sibling,
+ and previousSibling set to node's
+ previous sibling.
+
+
For each ancestor ancestor
+ of node, if ancestor has any
+ registered observers with the subtree
+ option set, add
+ an identical transient observer to node for
+ each such subtree registration on ancestor.
+
Remove node from its parent. @@ -1717,74 +1741,258 @@
This section will define the replacement for the -"Mutation Events" feature of the platform. For now it contains the interface -being implemented by vendors. -
[Constructor(MutationCallback callback)] interface MutationObserver { - void observe(Node target, MutationObserverInit options); - void disconnect(); + void observe(Node target, MutationObserverInit options); + void disconnect(); }; callback MutationCallback = void (MutationRecord[] mutations, MutationObserver observer); dictionary MutationObserverInit { - // Mutation types - boolean childList; // If true, mutations affecting node’s childNodes are included. - boolean attributes; // If true, mutations affecting element’s attributes are included. - boolean characterData; // If true, mutations affecting the value of CharacterData nodes are included. - // [Note: If none of the known mutation types is specified, an Error is thrown] - - // Subtree observation - boolean subtree; // If true, the observed set of nodes for this registration should include - // descendants of MutationTarget (behavior described below). - - // Old values - boolean attributeOldValue; - // If true, MutationRecords describing changes to attributes should - // contain the value of the attribute before the change. If true - // without attribute: true specified, an Error is thrown. - - boolean characterDataOldValue; - // If true, MutationRecords describing changes to - // CharacterData nodes should contain the value - // of the node before the change. If true without - // characterData: true, an Error is thrown. - - // Filtering - DOMString[] attributeFilter; - // If provided, only changes to attributes with localName equaling - // one of the provided strings will be delivered. If provided without - // attribute: true, an Error is thrown. + boolean childList; + boolean attributes; + boolean characterData; + boolean subtree; + boolean attributeOldValue; + boolean characterDataOldValue; + DOMString[] attributeFilter; }; interface MutationRecord { - // Mutation type: one of 'childList', 'attributes', or 'characterData' - readonly attribute DOMString type; - - // For childList and attributes, target is the owner node affected. - // For CharacterData, target is the node affected. - readonly attribute Node target; - - // For type == 'childList', Sequence of added and removed nodes in this operation. - readonly attribute NodeList addedNodes; - readonly attribute NodeList removedNodes; - - // For type == 'childList', The siblings in childNodes immediately preceding following the first - // and last nodes added and/or removed. - readonly attribute Node previousSibling; - readonly attribute Node nextSibling; - - // For type == 'attribute', the name and namespaceURI of the attribute affected - readonly attribute DOMString attributeName; - readonly attribute DOMString attributeNamespace; - - // For type == 'attribute' or 'characterData', if requested, the value immediately - // preceding the mutation. - readonly attribute DOMString oldValue; + readonly attribute DOMString type; + readonly attribute Node target; + readonly attribute NodeList? addedNodes; + readonly attribute NodeList? removedNodes; + readonly attribute Node? previousSibling; + readonly attribute Node? nextSibling; + readonly attribute DOMString? attributeName; + readonly attribute DOMString? attributeNamespace; + readonly attribute DOMString? oldValue; };- + +
When the constructor of the MutationObserver interface is invoked
+with callback callback and options options, run these steps:
+
+
If callback is null, throw a "NotFoundError" and terminate these steps.
+
Return a MutationObserver associated with the callback.
+
MutationObserver, it has three internal properties:
+An associated callback. +
A list of nodes on which it is registered. +
A queue of MutationRecords which are pending delivery.
+
A registered observer consists of an observer (an instance of MutationObserver),
+a set of options (an instance of MutationObserverInit), and a transient variable (whose default value is false).
+Each Node has a list of registered observers. A transient observer is a registered observer
+whose transient variable is set to true.
+
+
+
When the observe(target, options)
+method is called, these steps must be run:
+
+
If target is not a node,
+ throw a "NotFoundError" and terminate these steps.
+
+
If options is null, or is not an instance of MutationObserverInit,
+ throw a "TypeMismatchError" and terminate these steps.
+
+
Run these substeps, treating options as the context object: +
If neither childList, attributes, nor characterData is true,
+ throw a "SyntaxError" and terminate these steps.
+
+
If attributeOldValue is true and attributes is not true,
+ throw a "SyntaxError" and terminate these steps.
+
+
If attributeFilter is a non-empty array and attributes is not true,
+ throw a "SyntaxError" and terminate these steps.
+
+
If characterDataOldValue is true and characterData is not true,
+ throw a "SyntaxError" and terminate these steps.
+
If target's registration list already includes a registration associated with + the context object, replace that registrations's options with options. + +
Otherwise, add a new registration to target's registered observer list with the + context object as the observer and options as the options, + and add target to observer's list of nodes on which it is registered. +
When the disconnect method is called, for each
+node node in the context object's list of
+nodes, remove any registration on node for which
+the context object is the observer.
+
+
attributes" MutationRecord
+with target target, attributeName name, and oldValue oldValue,
+run these steps:
+
+Create a new MutationRecord record with type initialized to "attributes", target initialized to target,
+and attributeName initialized to name.
+
+
Create a copy of this record named recordWithOldValue and initialize its oldValue to oldValue. + +
For each registered observer observer (with options options) in + +target's registered observer list, run these substeps: +
If options does not have the attributes option set, terminate these substeps (and run them for the next observer).
+
+
If options has a non-empty attributeFilter array, and name is not in that array, terminate these substeps
+ (and run them for the next observer).
+
+
If options has the attributeOldValue option set, append recordWithOldValue to the observer's
+ queue of pending mutations.
+
+
Otherwise, append record to the observer's queue of pending mutations. +
For each ancestor ancestor of target, and for each + registered observer observer (with options options) in ancestor's + registered observer list, run these substeps: +
If options does not have the subtree option set, terminate these substeps (and run them for the next observer).
+
+
If options does not have the attributes option set, terminate these substeps (and run them for the next observer).
+
+
If options has a non-empty attributeFilter array, and name is not in that array, terminate these substeps
+ (and run them for the next observer).
+
+
If options has the attributeOldValue option set, append recordWithOldValue to the observer's
+ queue of pending mutations.
+
+
Otherwise, append record to the observer's queue of pending mutations. +
characterData" MutationRecord
+with target target and oldValue oldValue, run these steps:
+
+Create a new MutationRecord record with type initialized to "characterData" and target initialized to target.
+
+
Create a copy of this record named recordWithOldValue and initialize its oldValue to oldValue. + +
For each registered observer observer (with options options) in + target's registered observer list, run these substeps: +
If options does not have the characterData option set, terminate these substeps (and run them for the next observer).
+
+
If options has the characterDataOldValue option set, append recordWithOldValue to the observer's
+ queue of pending mutations.
+
+
Otherwise, append record to the observer's queue of pending mutations. +
For each ancestor ancestor of target, and for each + registered observer observer (with options options) in ancestor's + registered observer list, run these substeps: +
If options does not have the subtree option set, terminate these substeps (and run them for the next observer).
+
+
If options does not have the characterData option set, terminate these substeps (and run them for the next observer).
+
+
If options has the characterDataOldValue option set, append recordWithOldValue to the observer's
+ queue of pending mutations.
+
+
Otherwise, append record to the observer's queue of pending mutations. +
childList" MutationRecord
+with target target, addedNodes addedNodes, removedNodes removedNodes, previousSibling previousSibling,
+and nextSibling nextSibling, run these steps:
+
+Create a new MutationRecord record with type initialized to "childList", target initialized to target,
+ addedNodes initialized to addedNodes, removedNodes initialized to removedNodes,
+ previousSibling initialized to previousSibling, and nextSibling initialized to.
+
+
For each registered observer observer (with options options) in + target's registered observer list, run these substeps: +
If options does not have the childList option set, terminate these substeps (and run them for the next observer).
+
+
Append record to the observer's queue of pending mutations. +
For each ancestor ancestor of target, and for each + registered observer observer (with options options) in ancestor's + registered observer list, run these substeps: +
If options does not have the subtree option set, terminate these substeps (and run them for the next observer).
+
+
If options does not have the childList option set, terminate these substeps (and run them for the next observer).
+
+
Append record to the observer's queue of pending mutations. +
The type attribute must return
+a string representing the type of the mutation, which must be one of the following:
+
attributes"
+ childList"
+ characterData"
+The target attribute must
+return the node this mutation affected, which differs depending on the type.
+For childList mutations, it must be the node whose children changed.
+For attributes mutations, it must be the element whose attributes changed.
+For characterData mutations, it must be the CharacterData node whose value changed.
+
+
The addedNodes attribute must return
+the list of nodes added in this mutation, if it was a childList mutation. Otherwise it must return null.
+
+
The removedNodes attribute must return
+the list of nodes removed in this mutation, if it was a childList mutation. Otherwise it must return null.
+
+
The previousSibling attribute must return
+the node which was the previous sibling of the first element of addedNodes when the mutation occurred, if addedNodes is non-empty,
+or the node which was the previous sibling of the first element of removedNodes, if removedNodes is non-empty. Otherwise it must return null.
+
+
The nextSibling attribute must return
+the node which was the next sibling of the last item in addedNodes when the mutation occurred, if addedNodes is non-empty,
+or the node which was the next sibling of the last element of removedNodes, if removedNodes is non-empty. Otherwise it must return null.
+
+
The attributeName attribute must return
+the name of the modified attribute if this is an "attributes" mutation. Otherwise it must return null.
+
+
The attributeNamespace attribute must return
+the namespaceURI of the modified attribute if this is an "attributes" mutation. Otherwise it must return null.
+
+
The oldValue attribute varies in behavior
+based on the type of mutation:
+
+
If type is "childList", it must return null.
+
If type is "attributes" and the registered observation had the attributeOldValue option set, must return
+ the value of the attribute just before the mutation was made.
+
If type is "characterData" and the registered observation had the characterDataOldValue option set, must return the value of
+ the target's data attribute just before the mutation was made.
+
NodeIf node's
- parent is not null, remove
+ parent is not null, remove
node from its
parent.
@@ -4120,24 +4328,29 @@
name, throw a
"NamespaceError" and terminate these steps.
-
If the context object does not have an +
Let attribute be the + first attribute in the + context object's attribute list + whose name is + name, or null if there is no such + attribute. + +
If attribute is null, create an attribute whose name is - name, create an - attribute, whose - name is name and value is value, and then append this attribute to the - context object. - -
Otherwise, change the - first attribute in the - context object's - attribute list whose - name is - name, to value. + context object and terminate these steps. + +
Dispatch an "attributes"
+ MutationRecord with target set to the context object,
+ attributeName set to attribute's localName,
+ attributeNamespace set to attribute's namespaceURI,
+ and oldValue set to attribute's value.
+
+
Set attribute's value to value.
The
@@ -4183,14 +4396,18 @@
"xmlns", throw a
"NamespaceError" exception and terminate these steps.
-
If the context object does not - have an +
Let attribute be the + first attribute in the + context object's + attribute list + whose namespace is + namespace and whose + local name + is localName, or null if there is no such + attribute. + +
If attribute is null, create an attribute whose - namespace is - namespace and - local name is - localName, create an - attribute, whose name is name, namespace is @@ -4202,10 +4419,17 @@ is value, and then append this attribute to the - context object. - -
Otherwise, change that - attribute to value. + context object and terminate these steps. + +
Dispatch an
+ "attributes" MutationRecord with target
+ set to the context object, attributeName set to
+ name, attributeNamespace set to
+ namespace, and oldValue set to
+ attribute's value.
+
+
Set attribute's + value to value.
The @@ -4422,26 +4646,42 @@
To change an -attribute attribute to -value, set the attribute's -value to value. -
To append an attribute attribute to an element element, -append the attribute to the element's -attribute list. +run these steps: + +
Dispatch an
+ "attributes" MutationRecord with target
+ set to element, attributeName set to
+ attribute's localName,
+ attributeNamespace set to attribute's
+ namespaceURI,
+ and oldValue set to null.
+
+
Append the attribute to the element's + attribute list. +
To remove an attribute attribute from an element element, -remove the attribute from the element's -attribute list. - -
These definitions will be expanded upon in due course for -mutations. +run these steps: + +
Dispatch an
+ "attributes" MutationRecord with target
+ set to element, attributeName set to
+ attribute's localName,
+ attributeNamespace set to attribute's
+ namespaceURI, and oldValue
+ set to attribute's value.
+
+
Remove the attribute from the element's + attribute list. +
Dispatch
+ a "characterData" MutationRecord with target
+ set to node and oldValue set to
+ node's data.
+
Insert data into node's data after offset code units.