Today in the Reading JS DOM programming Art When you see the DOM Core and html-dom these 2 nouns, then online query, help record and understand;
The DOM (Document Object model) is a set of standards for accessing and manipulating XML (extensible Markup Language) documents developed by the consortium, the API. For example, the DOM tells the JavaScript engine how to display and manipulate XML-created markup (tag) in a browser window.
Dom is independent of specific platforms, browsers, and languages, and many languages implement DOM, as JavaScript and PHP implement DOM, so JavaScript has the getElementsByTagName () method, and PHP has The getElementsByTagName (), getElementsByTagName () method is the interface that the DOM prescribes to access an XML document.
XML is similar to HTML, but there is a difference between the two. Both XML and HTML come from SGML, and they all contain tags, with similar syntax, and the biggest difference between HTML and XML is that HTML is a trained markup language that describes and displays data with fixed tags, such as
Because of the similarities and differences between HTML and XML, JavaScript not only implements standard DOM methods and properties (i.e., created by the universe), but also implements HTML-specific DOM methods and properties, formerly known as Dom Core, and not specifically JavaScript. The latter is called Html-dom. Whether it's DOM core or html-dom, we should be aware of the compatibility between browsers when using JavaScript, because different browsers might not support these two types of methods and properties. DOM core and Html-dom, as well as cross-browser compatibility, are described in detail in the textbook. However, it is generally recommended to use the DOM core methods and properties, albeit slightly cumbersome.
the Common Core DOM methods are as follows :
1. Create a Node
CreateElement ()
createTextNode ()
2. Replication nodes
CloneNode ()
3. Inserting nodes
AppendChild ()
InsertBefore ()
4. Deleting nodes
RemoveChild ()
5. Replace node
ReplaceChild ()
6. Find and Set node properties
SetAttribute ()
GetAttribute ()
7. Find nodes
getElementById ()
getElementsByTagName ()
Haschildnode ()
the Common Core DOM properties are as follows :
Node.childnodes
Node.firstchild
Node.lastchild
Node.nextsibling
Node.previoussibling
Node.parentnode
[Transfer from csdn:http://blog.csdn.net/w11003060125/article/details/8549434]
Difference: DOM Core and Html-dom [go from csdn]