What are DOM levels?

前端 未结 6 1284
感情败类
感情败类 2021-01-30 10:54

I\'ve heard DOM level 2 and DOM level 3 mentioned in previous posts. Are these abstract constructs like the ISO OSI model which has layers 1-7 but are only loosely followed?

相关标签:
6条回答
  • 2021-01-30 11:06

    I know this question is old, but I'm adding this data for any people coming across this post.

    The DOM used to be written as a set of levels. That is no longer the case.

    These days it is maintained as the DOM Living Standard

    See also the DOM Reference for more recent web-developer-focused information.

    Source: Here

    0 讨论(0)
  • 2021-01-30 11:16

    DOM Levels are essentially versions.

    DOM Level 1 defines the core elements of the Document Object Model. DOM Level 2 extends those elements and adds events. DOM Level 3 extends DOM lvl 2 and adds more elements and events.

    Each new level of the DOM adds or changes specific sets of features. When browsers are said to be DOM Level X compliant developers can (hopefully) assume that the browser correctly handles the specified DOM api calls.

    0 讨论(0)
  • 2021-01-30 11:23

    Looking for levels of DOM? (MDN reference can be found here, W3 reference also is here)

    Alternatively, this could be referencing hierarchy of elements within the DOM. e.g.

    <p>Hello, <b>World</b>!</p>
    

    <p> being level 1, <b> level 2.

    0 讨论(0)
  • 2021-01-30 11:24

    DOM, “Document Object Model” in world wide Web W3C defines a standard for accessing documents

    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 You taking about JavaScript thus You need to know the HTML DOM.

    The HTML DOM is a standard object model and programming interface for HTML. It defines:

    The HTML elements as objects The properties of all HTML elements The methods to access all HTML elements The events for all HTML elements In other words: The HTML DOM is a standard for how to get, change, add, or delete HTML elements that is displayed in that window (Web Page). It has various properties that refer to other objects which allow access to and modification of document or webpage content with e.g.javascript

    For example: An HTML page has a button with an id=”txr1”.

    So how will you get the “txt1” value in JavaScript?

    document.getElementById('txt1');

    In above example, I am getting element with id=”btn1″ in javascript with the help of document element which is a DOM element.

    There are many other DOM elements which you can use in JavaScript to get and change elements of an HTML document.

    0 讨论(0)
  • 2021-01-30 11:28

    According to wiki

    Beginning with the publication of DOM Level 4 in 2015, the W3C creates new recommendations based on snapshots of the WHATWG standard.

    • DOM Level 1 provided a complete model for an entire HTML or XML document, including the means to change any portion of the document.
    • DOM Level 2 was published in late 2000. It introduced the getElementById function as well as an event model and support for XML namespaces and CSS.
    • DOM Level 3, published in April 2004, added support for XPath and keyboard event handling, as well as an interface for serializing documents as XML.
    • DOM Level 4 was published in 2015. It is a snapshot of the WHATWG living standard.[7]
    0 讨论(0)
  • 2021-01-30 11:30

    DOM Levels are the versions of the specification for defining how the Document Object Model should work, similarly to how we have HTML4, HTML5, and CSS2.1 specifications.

    As of 2020, the most recent spec is DOM Level 4, published in November 2015.

    Additionally, there are pieces of the DOM spec that vendors can choose to implement, such as Core, HTML, and XML, as well as the event model. Depending on what is being built (a DOM parser, web browser layout engine, or javascript engine), the vendor may choose to implement some or all of the spec. Most modern web browsers implement all of the Level 3 spec.

    0 讨论(0)
提交回复
热议问题