免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2015年5月20日 星期三

html node or element ? document or window ?


//=== node or element ?
http://www.w3schools.com/jsref/dom_obj_all.asp
"""...
In the HTML DOM (Document Object Model), everything is a node:

The document itself is a document node
All HTML elements are element nodes
All HTML attributes are attribute nodes
Text inside HTML elements are text nodes
Comments are comment nodes

..."""



//=== parentElement or parentNode ?
http://www.w3schools.com/jsref/prop_node_parentelement.asp


parentElement returns null if the parent node is not an element node

document.documentElement.parentNode; // Returns the "document" node
document.documentElement.parentElement; // Returns null

document.body.parentNode; // Returns the element
document.body.parentElement; // Returns the element


//=== document or window ?
http://www.w3schools.com/jsref/obj_window.asp

"""...
The window object represents an open window in a browser.

If a document contain frames (iframe tags), the browser creates one window object for the HTML document, and one additional window object for each frame.
..."""


//=== document object (Document object)
http://www.w3schools.com/jsref/dom_obj_document.asp

"""...
When an HTML document is loaded into a web browser, it becomes a document object.

The document object is the root node of the HTML document and the "owner" of all other nodes:
(element nodes, text nodes, attribute nodes, and comment nodes).

..."""

沒有留言:

張貼留言