Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

2.2.1 [DOM Level 2 - Core] Section 1.2, Fundamental Interfaces

C0006:

The specification describes the getElementsByTagName and getElementsByTagNameNS methods on the Document interface.

IE9 Mode, IE10 Mode, IE11 and Edge (beta) Mode (All Versions)

getElementsByTagName and getElementsByTagNameNS return a HTMLCollection rather than a NodeList.

C0001:

The specification states:

Interface Document

Attributes
Doctype of type DocumentType, readonly
The Document Type Declaration (see DocumentType) associated with this document. For 
HTML documents as well as XML documents without a document type declaration this 
returns null. The DOM Level 2 does not support editing the Document Type 
Declaration. docType cannot be altered in any way, including through the use of 
methods inherited from the Node interface, such as insertNode or removeNode.

Quirks Mode, IE7 Mode, and IE8 Mode (All Versions)

The following clarifcations apply:

  • Because the DocumentType interface is not supported, the doctype attribute returns null.

  • The DocumentType instances in HTML documents are created as Comment instances and can be accessed using other DOM methods, typically document.firstChild.

C0002:

The specification states:

Interface Document

Method
createComment
Creates a Comment node given the specified string. 

Parameters 
data of type DOMString
The data for the node.

Return Value 
Comment The new Comment object.

No Exceptions

Quirks Mode, IE7 Mode, and IE8 Mode (All Versions)

With the createComment method of the Document interface, the data parameter is treated as optional and creates a Comment Node even when no parameter is provided.

C0003:

The specification states:

Interface Document

Method
createTextNode
Creates a Text node given the specified string. 

Parameters 
data of type DOMString
The data for the node.

Return Value 
Text The new Text object.

No Exceptions

Quirks Mode, IE7 Mode, and IE8 Mode (All Versions)

The data parameter of the createTextNode method is treated as optional, and the createTextNode method creates a text node even when no parameter is provided.

V0029:

The specification states:

Interface NamedNodeMap

Method
setNamedItem
Adds a node using its nodeName attribute. If a node with that name is already 
present in this map, it is replaced by the new one.
As the nodeName attribute is used to derive the name which the node must be stored 
under, multiple nodes of certain types (those that have a "special" string value) 
cannot be stored as the names would clash. This is seen as preferable to allowing 
nodes to be aliased. 

Parameters 
arg of type Node
A node to store in this map. The node will later be accessible using the value of 
its nodeName attribute.

Return Value 
Node If the new Node replaces an existing node the replaced Node is returned, 
otherwise null is returned.

Exceptions 
DOMException WRONG_DOCUMENT_ERR: Raised if arg was created from a different 
document than the one that created this map.

NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of 
another Element object. The DOM user must explicitly clone Attr nodes to re-use 
them in other elements

All Document Modes (All Versions)

An exception is not raised when the argument was created from a different document.

C0004:

The specification states:

Attributes
length of type unsigned long, readonly
The number of 16-bit units that are available through data and the substringData 
method below. This may have the value zero, i.e., CharacterData nodes may be empty.

Quirks Mode, IE7 Mode, and IE8 Mode (All Versions)

Text nodes are not created when a node contains only white space. The length attribute is not available if the text node is not created.

C0005:

The specification states:

Interface Element

Attribute
tagName of type DOMString, readonly 
The name of the element. For example, in: 
<elementExample id="demo"> 

</elementExample> ,
tagName has the value "elementExample". Note that this is case-preserving in XML, 
as are all of the operations of the DOM. The HTML DOM returns the tagName of an 
HTML element in the canonical uppercase form, regardless of the case in the source 
HTML document.

Quirks Mode, IE7 Mode, and IE8 Mode (All Versions)

The tagName property returns uppercase values except for elements with names that resemble namespaces (such as <test:elementName>) when a proprietary namespace has been declared. In this case, the tagName property drops the element prefixes and does not return uppercase values.

Show:
© 2015 Microsoft