tags:

views:

1113

answers:

6

What is the meaning of DOM element in the following statements?

Statement #1

You can add multiple classes to a single DOM element.

Statement #2

The -- point is that inheritance in CSS is done not through classes, but through element hierarchies. So to model inherited traits you need to apply them to different levels of elements in the DOM.

I know that DOM stands for Domain Object Model. It seems to be synonym to API in the statements.

+4  A: 

It's actually Document Object Model. HTML is used to build the DOM which is an in-memory representation of the page (while closely related to HTML, they are not exactly the same thing). Things like CSS and Javascript interact with the DOM.

geofflane
+6  A: 

Document object model.
The DOM is the way Javascript sees its containing pages' data. It is an object that includes how the HTML/XHTML/XML is formatted, as well as the browser state.

A DOM element is something like a DIV, HTML, BODY element on a page. You can add classes to all of these using CSS, or interact with them using JS.

Ian Elliott
+1 for concrete examples.
Masi
+1  A: 

See that your statements refer to "elements of the DOM", which are things such as the HTML tags (A, INPUT, etc). Thse statements simply mean that multiple CSS classes may be assigned to one such element.

Otávio Décio
+3  A: 

Document Object Model (DOM), a programming interface specification being developed by the World Wide Web Consortium (W3C), lets a programmer create and modify HTML pages and XML documents as full-fledged program objects.

PSU_Kardi
+2  A: 

If the statements are in the context of how CSS affects HTML then DOM element refers to an HTML element.

Martin Liversage
@Martin: Great example!
Masi
+1  A: 

Hi

As per W3C: DOM permits programs and scripts to dynamically access and update the content, structure and style of XML or HTML documents.

DOM is composed of:

  • set of objects/elements
  • a structure of how these objects/elements can be combined
  • and an interface to access and modify them

cheers

Andriyev