Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What DOM elements are not HTML elements?

Tags:

html

dom

The MDN documentation on addEventListener reads:

It works on any DOM element, not just HTML elements.

What DOM elements are not HTML elements? XML? Others?

like image 239
Dan Dascalescu Avatar asked Jul 01 '15 06:07

Dan Dascalescu


1 Answers

You can add event listeners to any DOM object not only HTML elements. i.e the window object. Basically, all the statement is saying is that you are not confined to the HTML elements only.

The DOM is a W3C (World Wide Web Consortium) standard.

The DOM defines a standard for accessing documents:

"The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."

The W3C DOM standard is separated into 3 different parts:

  • Core DOM - standard model for all document types

  • XML DOM - standard model for XML documents

  • HTML DOM - standard model for HTML documents

Here is a useful link which should give you more information about the HTML DOM http://www.w3schools.com/js/js_htmldom.asp.

You should also have a look at http://www.w3schools.com/js/js_htmldom_eventlistener.asp.

Here is the official W3C recommendation: http://www.w3.org/TR/DOM-Level-2-Core/introduction.html

like image 104
Vincent Charette Avatar answered Oct 27 '22 14:10

Vincent Charette