SlideShare a Scribd company logo
1 of 1
Download to read offline
The most common DOM methods at a glance
Reaching Elements in a Document                                                      Creating New Nodes
document.getElementById('id'): Retrieves the element with                             document.createElement(element): Creates a new element
the given id as an object                                                             node with the name element. You provide the name as a string.
document.getElementsByTagName('tagname'): Retrieves all                               document.createTextNode(string): Creates a new text node
elements with the tag name tagname and stores them in an array-                       with the node value of string.
like list
                                                                                      newNode = node.cloneNode(bool): Creates newNode as a copy
Reading Element Attributes, Node Values and Other Data                                (clone) of node. If bool is true, the clone includes clones of all the
                                                                                      child nodes of the original.
node.getAttribute('attribute'): Retrieves the value of the
                                                                                      node.appendChild(newNode): Adds newNode as a new (last) child
attribute with the name attribute
                                                                                      node to node.
node.setAttribute('attribute', 'value'): Sets the value
                                                                                      node.insertBefore(newNode,oldNode): Inserts newNode as a
of the attribute with the name attribute to value
                                                                                      new child node of node before oldNode.
node.nodeType: Reads the type of the node (1 = element, 3 = text
                                                                                      node.removeChild(oldNode): Removes the child oldNode from
node)
                                                                                      node.
node.nodeName: Reads the name of the node (either element
                                                                                      node.replaceChild(newNode, oldNode): Replaces the child
name or #textNode)
                                                                                      node oldNode of node with newNode.
node.nodeValue: Reads or sets the value of the node (the text
                                                                                      element.innerHTML: Reads or writes the HTML content of the given
content in the case of text nodes)
                                                                                      element as a string—including all child nodes with their attributes and
Navigating Between Nodes                                                              text content.

node.previousSibling: Retrieves the previous sibling node and                        Known browser quirks:
stores it as an object.
                                                                                      getAttribute and setAttribute are not reliable. Instead, assign
node.nextSibling: Retrieves the next sibling node and stores it                       the property of the element object directly: obj.property = value.
as an object.                                                                         Furthermore, some attributes are actually reserved words, so instead
node.childNodes: Retrieves all child nodes of the object and                          of class use className and instead of for use HTMLfor.
stores them in an list. here are shortcuts for the first and last child               Real DOM compliant browsers will return linebreaks as text nodes in
node, named node.firstChild and node.lastChild.                                       the childNodes collection, make sure to either remove them or test
node.parentNode: Retrieves the node containing node.                                  for the nodeType.




                           Assembled by Christian Heilmann (http://wait-till-i.com), licensed Creative Commons Attribution (http://creativecommons.org/licenses/by/3.0/). Enjoy.

More Related Content

What's hot

Lecture 4.2 c++(comlete reference book)
Lecture 4.2 c++(comlete reference book)Lecture 4.2 c++(comlete reference book)
Lecture 4.2 c++(comlete reference book)Abu Saleh
 
What is String in Java?
What is String in Java?What is String in Java?
What is String in Java?RAKESH P
 
Cordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced JavascriptCordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced JavascriptBinu Paul
 
Unit7 jwfiles
Unit7 jwfilesUnit7 jwfiles
Unit7 jwfilesmrecedu
 
Brief Summary Of C++
Brief Summary Of C++Brief Summary Of C++
Brief Summary Of C++Haris Lye
 
Uncommon Design Patterns
Uncommon Design PatternsUncommon Design Patterns
Uncommon Design PatternsStefano Fago
 
Excel to Use Rest API to communicate with a server
Excel to Use Rest API to communicate with a serverExcel to Use Rest API to communicate with a server
Excel to Use Rest API to communicate with a serverdocuboy
 
Krazykoder struts2 internationalization
Krazykoder struts2 internationalizationKrazykoder struts2 internationalization
Krazykoder struts2 internationalizationKrazy Koder
 
Data Types/Structures in DivConq
Data Types/Structures in DivConqData Types/Structures in DivConq
Data Types/Structures in DivConqeTimeline, LLC
 

What's hot (14)

Binary tree in java
Binary tree in javaBinary tree in java
Binary tree in java
 
Data perisistence in iOS
Data perisistence in iOSData perisistence in iOS
Data perisistence in iOS
 
GPU programming
GPU programmingGPU programming
GPU programming
 
Lecture 4.2 c++(comlete reference book)
Lecture 4.2 c++(comlete reference book)Lecture 4.2 c++(comlete reference book)
Lecture 4.2 c++(comlete reference book)
 
What is String in Java?
What is String in Java?What is String in Java?
What is String in Java?
 
Cordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced JavascriptCordova training : Day 4 - Advanced Javascript
Cordova training : Day 4 - Advanced Javascript
 
Unit7 jwfiles
Unit7 jwfilesUnit7 jwfiles
Unit7 jwfiles
 
Brief Summary Of C++
Brief Summary Of C++Brief Summary Of C++
Brief Summary Of C++
 
Uncommon Design Patterns
Uncommon Design PatternsUncommon Design Patterns
Uncommon Design Patterns
 
โค้ด
โค้ดโค้ด
โค้ด
 
front-end dev
front-end devfront-end dev
front-end dev
 
Excel to Use Rest API to communicate with a server
Excel to Use Rest API to communicate with a serverExcel to Use Rest API to communicate with a server
Excel to Use Rest API to communicate with a server
 
Krazykoder struts2 internationalization
Krazykoder struts2 internationalizationKrazykoder struts2 internationalization
Krazykoder struts2 internationalization
 
Data Types/Structures in DivConq
Data Types/Structures in DivConqData Types/Structures in DivConq
Data Types/Structures in DivConq
 

Viewers also liked

Bancos De Cordon Umbilical
Bancos De Cordon Umbilical
Bancos De Cordon Umbilical
Bancos De Cordon Umbilical seccionmadre
 
The Individual Credibility Process of Internet Users
The Individual Credibility Process of Internet UsersThe Individual Credibility Process of Internet Users
The Individual Credibility Process of Internet UsersElizabeth Beasley
 
Dna structure
Dna structureDna structure
Dna structurevjcummins
 
APP 概念工作坊
APP 概念工作坊APP 概念工作坊
APP 概念工作坊Tim Hong
 
CALENDARIO DE RECUPERACIONES
CALENDARIO DE RECUPERACIONESCALENDARIO DE RECUPERACIONES
CALENDARIO DE RECUPERACIONESmoniki
 
Twitter as a Universal Information Stream
Twitter as a Universal Information StreamTwitter as a Universal Information Stream
Twitter as a Universal Information Streamrdale
 
ゲームのレビューから収集した意見の集約
ゲームのレビューから収集した意見の集約ゲームのレビューから収集した意見の集約
ゲームのレビューから収集した意見の集約utsuro_lab
 
How to solve Ramanujan's problem by numerical method 1
How to solve Ramanujan's problem by numerical method 1How to solve Ramanujan's problem by numerical method 1
How to solve Ramanujan's problem by numerical method 1สมต๋อง มข.
 

Viewers also liked (12)

Programa academico(profesiones)
Programa academico(profesiones)Programa academico(profesiones)
Programa academico(profesiones)
 
Bancos De Cordon Umbilical
Bancos De Cordon Umbilical
Bancos De Cordon Umbilical
Bancos De Cordon Umbilical
 
The Individual Credibility Process of Internet Users
The Individual Credibility Process of Internet UsersThe Individual Credibility Process of Internet Users
The Individual Credibility Process of Internet Users
 
Video analysis
Video analysisVideo analysis
Video analysis
 
Dna structure
Dna structureDna structure
Dna structure
 
Base de datos ii
Base de datos iiBase de datos ii
Base de datos ii
 
APP 概念工作坊
APP 概念工作坊APP 概念工作坊
APP 概念工作坊
 
CALENDARIO DE RECUPERACIONES
CALENDARIO DE RECUPERACIONESCALENDARIO DE RECUPERACIONES
CALENDARIO DE RECUPERACIONES
 
Onet computer
Onet computer Onet computer
Onet computer
 
Twitter as a Universal Information Stream
Twitter as a Universal Information StreamTwitter as a Universal Information Stream
Twitter as a Universal Information Stream
 
ゲームのレビューから収集した意見の集約
ゲームのレビューから収集した意見の集約ゲームのレビューから収集した意見の集約
ゲームのレビューから収集した意見の集約
 
How to solve Ramanujan's problem by numerical method 1
How to solve Ramanujan's problem by numerical method 1How to solve Ramanujan's problem by numerical method 1
How to solve Ramanujan's problem by numerical method 1
 

Similar to Java script dom-cheatsheet)

Similar to Java script dom-cheatsheet) (20)

DOM and Events
DOM and EventsDOM and Events
DOM and Events
 
12. session 12 java script objects
12. session 12   java script objects12. session 12   java script objects
12. session 12 java script objects
 
iOS Session-2
iOS Session-2iOS Session-2
iOS Session-2
 
INTRODUCTION TO DOM AND DOM TREE
INTRODUCTION TO DOM AND DOM TREEINTRODUCTION TO DOM AND DOM TREE
INTRODUCTION TO DOM AND DOM TREE
 
Javascript closures
Javascript closures Javascript closures
Javascript closures
 
Dom
Dom Dom
Dom
 
6867389.ppt
6867389.ppt6867389.ppt
6867389.ppt
 
6867389.ppt
6867389.ppt6867389.ppt
6867389.ppt
 
6867389 (1).ppt
6867389 (1).ppt6867389 (1).ppt
6867389 (1).ppt
 
Drupal 7 entities & TextbookMadness.com
Drupal 7 entities & TextbookMadness.comDrupal 7 entities & TextbookMadness.com
Drupal 7 entities & TextbookMadness.com
 
java classes
java classesjava classes
java classes
 
descriptive programming
descriptive programmingdescriptive programming
descriptive programming
 
JNDI
JNDIJNDI
JNDI
 
dom.ppt
dom.pptdom.ppt
dom.ppt
 
About Python
About PythonAbout Python
About Python
 
11. session 11 functions and objects
11. session 11   functions and objects11. session 11   functions and objects
11. session 11 functions and objects
 
Html dom part-ii
Html dom part-iiHtml dom part-ii
Html dom part-ii
 
Xml dom & sax by bhavsingh maloth
Xml dom & sax by bhavsingh malothXml dom & sax by bhavsingh maloth
Xml dom & sax by bhavsingh maloth
 
Ado.net session13
Ado.net session13Ado.net session13
Ado.net session13
 
packages and interfaces
packages and interfacespackages and interfaces
packages and interfaces
 

Recently uploaded

ARt app | UX Case Study
ARt app | UX Case StudyARt app | UX Case Study
ARt app | UX Case StudySophia Viganò
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Sitegalleryaagency
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdfSwaraliBorhade
 
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Yantram Animation Studio Corporation
 
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfThe_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfAmirYakdi
 
WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsCharles Obaleagbon
 
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiVIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
Design Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryDesign Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryWilliamVickery6
 
Fashion trends before and after covid.pptx
Fashion trends before and after covid.pptxFashion trends before and after covid.pptx
Fashion trends before and after covid.pptxVanshNarang19
 
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Narsimha murthy
 
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightCheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightDelhi Call girls
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130Suhani Kapoor
 
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...Pooja Nehwal
 
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...Amil baba
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024CristobalHeraud
 
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)jennyeacort
 
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Service
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Service
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Servicejennyeacort
 
Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...
Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...
Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...ankitnayak356677
 
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

ARt app | UX Case Study
ARt app | UX Case StudyARt app | UX Case Study
ARt app | UX Case Study
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Site
 
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf
 
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
Captivating Charm: Exploring Marseille's Hillside Villas with Our 3D Architec...
 
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfThe_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
 
WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past Questions
 
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service AmravatiVIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
VIP Call Girl Amravati Aashi 8250192130 Independent Escort Service Amravati
 
Design Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William VickeryDesign Portfolio - 2024 - William Vickery
Design Portfolio - 2024 - William Vickery
 
Fashion trends before and after covid.pptx
Fashion trends before and after covid.pptxFashion trends before and after covid.pptx
Fashion trends before and after covid.pptx
 
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...Revit Understanding Reference Planes and Reference lines in Revit for Family ...
Revit Understanding Reference Planes and Reference lines in Revit for Family ...
 
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightCheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
 
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...Kurla Call Girls Pooja Nehwal📞 9892124323 ✅  Vashi Call Service Available Nea...
Kurla Call Girls Pooja Nehwal📞 9892124323 ✅ Vashi Call Service Available Nea...
 
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
NO1 Famous Amil Baba In Karachi Kala Jadu In Karachi Amil baba In Karachi Add...
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
 
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)
Call Us ✡️97111⇛47426⇛Call In girls Vasant Vihar༒(Delhi)
 
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Service
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Service
Call Girls In Safdarjung Enclave 24/7✡️9711147426✡️ Escorts Service
 
Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...
Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...
Raj Nagar Extension Call Girls 9711199012 WhatsApp No, Delhi Escorts in Raj N...
 
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
 

Java script dom-cheatsheet)

  • 1. The most common DOM methods at a glance Reaching Elements in a Document Creating New Nodes document.getElementById('id'): Retrieves the element with document.createElement(element): Creates a new element the given id as an object node with the name element. You provide the name as a string. document.getElementsByTagName('tagname'): Retrieves all document.createTextNode(string): Creates a new text node elements with the tag name tagname and stores them in an array- with the node value of string. like list newNode = node.cloneNode(bool): Creates newNode as a copy Reading Element Attributes, Node Values and Other Data (clone) of node. If bool is true, the clone includes clones of all the child nodes of the original. node.getAttribute('attribute'): Retrieves the value of the node.appendChild(newNode): Adds newNode as a new (last) child attribute with the name attribute node to node. node.setAttribute('attribute', 'value'): Sets the value node.insertBefore(newNode,oldNode): Inserts newNode as a of the attribute with the name attribute to value new child node of node before oldNode. node.nodeType: Reads the type of the node (1 = element, 3 = text node.removeChild(oldNode): Removes the child oldNode from node) node. node.nodeName: Reads the name of the node (either element node.replaceChild(newNode, oldNode): Replaces the child name or #textNode) node oldNode of node with newNode. node.nodeValue: Reads or sets the value of the node (the text element.innerHTML: Reads or writes the HTML content of the given content in the case of text nodes) element as a string—including all child nodes with their attributes and Navigating Between Nodes text content. node.previousSibling: Retrieves the previous sibling node and Known browser quirks: stores it as an object. getAttribute and setAttribute are not reliable. Instead, assign node.nextSibling: Retrieves the next sibling node and stores it the property of the element object directly: obj.property = value. as an object. Furthermore, some attributes are actually reserved words, so instead node.childNodes: Retrieves all child nodes of the object and of class use className and instead of for use HTMLfor. stores them in an list. here are shortcuts for the first and last child Real DOM compliant browsers will return linebreaks as text nodes in node, named node.firstChild and node.lastChild. the childNodes collection, make sure to either remove them or test node.parentNode: Retrieves the node containing node. for the nodeType. Assembled by Christian Heilmann (http://wait-till-i.com), licensed Creative Commons Attribution (http://creativecommons.org/licenses/by/3.0/). Enjoy.