SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Dom

  1. #1
    SitePoint Wizard bronze trophy conradical's Avatar
    Join Date
    Jan 2005
    Location
    Atlanta
    Posts
    2,355
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)

    Dom

    Can some one explain what DOM is and, is it necessary (or helpful) to experiment with XHTML and Javascript for web design?

  2. #2
    SitePoint Guru momos's Avatar
    Join Date
    Apr 2004
    Location
    Belgium
    Posts
    919
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    a programming-interface to everything from html to css to events (http://www.w3.org/DOM/). Why wouldn't it be helpful? Google for things like unobtrusive javascript and XHTML vs HTML

  3. #3
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CSS and javascript works with the DOM, not the source code itself. When the browser parses an HTML or XML document it builds up a DOM tree. For instance, the following document:
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><title>Test</title><p>Test
    ...will (in compliant HTML4 parsers) generate this DOM tree:
    Code:
    HTML
     | HEAD
     | | TITLE
     |   | #text
     | BODY
       | P
         | #text
    You can thus style the BODY element with CSS for instance, even though you can't see any BODY tags in the markup. You can also grab the BODY element with javascript, with:
    Code:
    var objBody = document.body;
    ...or:
    Code:
    var objBody = document.getElementsByTagName("body")[0];
    In XML the markup reflects the DOM more accurately than with tag soup (text/html). XML also has namespaces, so you can use the @namespace at-rule in CSS and use namespace aware DOM methods in javascript such as getElementsByTagNameNS.
    Simon Pieters

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The Document Object Model provides a standard mechanism for accessing the contents of an HTML or XML document. A document (web page) is represented as a hierarchical tree of nodes. A node can be an element, a text node, a processing instruction, etc.

    The DOM Core provides the necessary interfaces to manipulate a document. The are other modules as well, such as DOM Style for manipulating style sheets and DOM Event for handling events.
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •