Package | dom.core |
Class | public class DocumentFragment |
Inheritance | DocumentFragment Node Object |
Implements | NodeSelector |
Introduced in: | DOM 1 Core |
It is used as a light-weight version of document to store well-formed or potentially non-well-formed fragments of XML.
Various other methods can take a document fragment as an argument (e.g., any Node interface methods such as appendChild and insertBefore), in which case the children of the fragment are appended or inserted, not the fragment itself.
See also
Method | Defined By | ||
---|---|---|---|
Associates a function with a particular event and binds the event to the current node. | Node | ||
DOM 3 Events addEventListenerNS(namespaceURI:DOMString, type:DOMString, listener:EventListener, useCapture:Boolean):void
Registers an event listener, depending on the useCapture parameter, on the
capture phase of the DOM event flow or its target and bubbling phases. | Node | ||
Adds a node to the end of the list of children of a specified parent node. | Node | ||
Returns a duplicate of the current node. | Node | ||
Compares the position of the current node against another node in any other document. | Node | ||
Dispatches an event to fire on a node artificially. | Node | ||
This method returns a specialized object which implements the
specialized APIs of the specified feature and version, as specified
in DOM Features. | Node | ||
Retrieves the object associated to a key on a this node. | Node | ||
DOM 2 Core hasAttributes():Boolean
Returns a boolean value of true or false, indicating if the current element
has any attributes or not. | Node | ||
DOM 1 Core hasChildNodes():Boolean
Returns a value that indicates whether the object has children. | Node | ||
Inserts the specified node before a reference element as a child of
the current node. | Node | ||
Returns true if the namespace is the default namespace on the given
node or false if not. | Node | ||
Tests whether two nodes are equal. | Node | ||
Returns whether this node is the same node as the given one. | Node | ||
Tests whether the DOM implementation implements a specific feature
and that feature is supported by this node. | Node | ||
Takes a prefix and returns the namespaceURI associated with it on the
given node if found (and null if not). | Node | ||
Returns the prefix for a given namespaceURI if present, and null if not. | Node | ||
DOM 1 Core normalize():void
Puts the specified node and all of its subtree into a "normalized"
form. | Node | ||
Returns the first element that is a descendent of the element on which it is invoked that matches the specified group of selectors. | DocumentFragment | ||
Returns a list of all elements descended from the element on which it is invoked that match the specified group of selectors. | DocumentFragment | ||
Removes a child node from the object. | Node | ||
Removes an event listener. | Node | ||
DOM 3 Events removeEventListenerNS(namespaceURI:DOMString, type:DOMString, listener:EventListener, useCapture:Boolean):void
Removes an event listener. | Node | ||
Replaces an existing child element with a new child element. | Node | ||
Applies the specified pattern-matching operation to this node's context and returns the list of matching nodes as IXMLDOMNodeList. | Node | ||
Applies the specified pattern-matching operation to this node's context and returns the first matching node. | Node | ||
Associate an object to a key on this node. | Node | ||
Processes this node and its children using the supplied Extensible Stylesheet Language Transformations
(XSLT) style sheet and returns the resulting transformation. | Node | ||
Processes this node and its children using the supplied Extensible Stylesheet Language Transformations (XSLT) style sheet
and returns the resulting transformation. | Node |
Event | Summary | Defined By | ||
---|---|---|---|---|
This is a general event for notification of all changes to the document. | DocumentFragment |
Selectors API querySelector | () | method |
public function querySelector(selectors:DOMString):Element
Introduced in: | DOM 3 Core |
Returns the first element that is a descendent of the element on which it is invoked that matches the specified group of selectors.
Parameters
selectors:DOMString — One or more selectors
|
Element — The first matching Element node within the node’s subtree. If there is no such node, returns null.
|
See also
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Selectors API Example</title> </head> <body> <div id="foo"> <p class="warning">This is a sample warning</p> <p class="error">This is a sample error</p> </div> <div id="bar"> <p>...</p> </div> </body> </html>
var x = document.querySelector("#foo, #bar");
Selectors API querySelectorAll | () | method |
public function querySelectorAll(selectors:DOMString):NodeList
Product Versions : | 5.5 6.0 7.0 8.0 as IE7 8.0 as IE8 2.0 3.0 3.5b4 3.0 3.1 4.0 1.0 2.0 9.62 10.0b |
Introduced in: | DOM 3 Core |
Returns a list of all elements descended from the element on which it is invoked that match the specified group of selectors.
Parameters
selectors:DOMString — One or more selectors
|
NodeList — A NodeList containing all of the matching Element nodes within the node’s subtree, in document order. If there are no such nodes, returns an empty NodeList.
|
See also
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Selectors API Example</title> </head> <body> <div id="foo"> <p class="warning">This is a sample warning</p> <p class="error">This is a sample error</p> </div> <div id="bar"> <p>...</p> </div> </body> </html>
var alerts = document.querySelectorAll("p.warning, p.error");
DOMSubtreeModified | Event |
dom.events.MutationEvent
DOMSubtreeModified
This is a general event for notification of all changes to the document. It can be used instead of the more specific mutation and mutation name events listed below. It may be dispatched after a single modification to the document or, at the implementation's discretion, after multiple changes have occurred. The latter use should generally be used to accommodate multiple changes which occur either simultaneously or in rapid succession. The target of this event is the lowest common parent of the changes which have taken place. This event is dispatched after any other events caused by the mutation(s) have occurred.