Page 120 - DCAP202_Fundamentals of Web Programming
P. 120
Unit 9: DOM Model
9.1.3 Nodes Notes
A Node is an interface from which a number of DOM types inherit, and allows these various
types to be treated (or tested) similarly, the Node object represents a single node in the document
tree.
A node can be an element node, an attribute node, a text node, or any other of the node types
.Notice that while all objects inherits the Node properties/methods for dealing with parents
and children, not all objects can have parents or children.
Example: Text nodes may not have children, and adding children to such nodes results in
a DOM error.
Self Assessment
Fill in the blanks:
1. The ........................... is a programming API for documents.
2. The DOM Core represents the functionality used for ........................... documents.
3. Variables associated with an object are called ........................... of the object.
4. The M in DOM stands for Model, but it could just as easily stand for ...........................
5. A ........................... is an interface from which a number of DOM types inherit, and allows
these various types to be treated (or tested) similarly.
9.2 Objects in HTML
The Object object represents an HTML object element.
The <object> tag is used to include objects such as images, audio, videos, Java applets, ActiveX,
PDF, and Flash into a webpage.
9.2.1 Document Object
The Document object is the root of a document tree. The Document object gives us access to the
document’s data. Since element nodes, text nodes, attributes, comments, etc. cannot exist outside
the document, the Document object contains methods to create these objects. All Node objects
have a ownerDocument property which associates them with the Document where they were
created.
Object is supported in all major browsers.
Document Object Properties
The “DOM” column indicates in which DOM Level the property was introduced.
Property Description DOM
Returns the Document Type Declaration associated with
doctype 1
the document
Returns the Document Element of the document (the
documentElement 1
HTML element)
Contd....
documentURI Sets or returns the location of the document 3
Returns the configuration used when normalize
domConfig 3
Document() is invoked
LOVELY PROFESSIONAL UNIVERSITY
Returns the DOMImplementation object that handles this 113
implementation 1
document
inputEncoding Returns the encoding, character set, used for the document 3
strictErrorChecking Sets or returns whether error-checking is enforced or not 3
xmlEncoding Returns the XML encoding of the XML document 3
Sets or returns whether the XML document is standalone
xmlStandalone 3
or not
xmlVersion Sets or returns the XML version of the XML document 3