Flylib.com

Books Software

 
 
 

Section 25.57. Document.addEventListener( ): see Element.addEventListener( )


25.57. Document.addEventListener( ): see Element.addEventListener( )



25.58. Document.attachEvent( ): see Element.attachEvent( )



25.59. Document.createAttribute( ): create a new Attr node

DOM Level 1 Core:

25.59.1. Synopsis

Attr createAttribute(String


name


)
    tHRows DOMException;

25.59.1.1. Arguments


name

The name for the newly created attribute.

25.59.1.2. Returns

A newly created Attr node with its nodeName property set to name .

25.59.1.3. Throws

This method throws a DOMException with a code of INVALID_CHARACTER_ERR if name contains an illegal character.

25.59.2. See Also

Attr , Element.setAttribute( ) , Element.setAttributeNode( )



25.60. Document.createAttributeNS( ): create an Attr with a name and namespace

DOM Level 2 Core:

25.60.1. Synopsis

Attr createAttributeNS(String


namespaceURI


,
                       String


qualifiedName


)
    throws DOMException;

25.60.1.1. Arguments


namespaceURI

The unique identifier of the namespace for the Attr or null for no namespace.



qualifiedName

The qualified name of the attribute, which should include a namespace prefix, a colon , and a local name.

25.60.1.2. Returns

A newly created Attr node with the specified name and namespace.

25.60.1.3. Throws

This method may throw a DOMException with one of the following code values in the following circumstances:



INVALID_CHARACTER_ERR

qualifiedName contains an illegal character.



NAMESPACE_ERR

qualifiedName is malformed or there is a mismatch between qualifiedName and namespaceURI .



NOT_SUPPORTED_ERR

The implementation does not support XML documents and therefore does not implement this method.

25.60.2. Description

createAttributeNS( ) is just like createAttribute( ) , except that the created Attr node has a name and namespace instead of just a name. This method is useful only with XML documents that use namespaces.



25.61. Document.createCDATASection( ): create a new CDATASection node

DOM Level 1 Core:

25.61.1. Synopsis

CDATASection createCDATASection(String


data


)
    tHRows DOMException;

25.61.1.1. Arguments


data

The text of the CDATASection to create.

25.61.1.2. Returns

A newly created CDATASection node, with the specified data as its contents.

25.61.1.3. Throws

If the document is an HTML document, this method throws a DOMException with a code of NOT_SUPPORTED_ERR because HTML documents do not allow CDATASection nodes.



25.62. Document.createComment( ): create a new Comment node

DOM Level 1 Core:

25.62.1. Synopsis

Comment createComment(String


data


);

25.62.1.1. Arguments


data

The text of the Comment node to create.

25.62.1.2. Returns

A newly created Comment node, with the specified data as its text.



25.63. Document.createDocumentFragment( ): create a new, empty DocumentFragment node

DOM Level 1 Core:

25.63.1. Synopsis

DocumentFragment createDocumentFragment( );

25.63.1.1. Returns

A newly created DocumentFragment node with no children.



25.64. Document.createElement( ): create a new Element node

DOM Level 1 Core:

25.64.1. Synopsis

Element createElement(String


tagName


)
    tHRows DOMException;

25.64.1.1. Arguments


tagName

The tag name of the Element to be created. Since HTML tags are case-insensitive, you may use any capitalization for HTML tag names. XML tag names are case-sensitive.

25.64.1.2. Returns

A newly created Element node with the specified tag name.

25.64.1.3. Throws

This method throws a DOMException with a code of INVALID_CHARACTER_ERR if tagName contains an illegal character.