What does idl attribute mean in the WHATWG html5 standard document?

The IDL (Interface Definition Language) comes from the Web IDL spec:

This document defines an interface definition language, Web IDL, that
can be used to describe interfaces that are intended to be implemented
in web browsers. Web IDL is an IDL variant with a number of features
that allow the behavior of common script objects in the web platform
to be specified more readily. How interfaces described with Web IDL
correspond to constructs within ECMAScript execution environments is
also detailed in this document.

Content attributes are the ones that appear in the markup:

<div id="mydiv" class="example"></div>

In the above code id and class are attributes. Usually a content attribute will have a corresponding IDL attribute.

For example, the following JavaScript:

document.getElementById('mydiv').className="example"

Is equivalent to setting the class content attribute.

In JavaScript texts, the IDL attributes are often referred to as properties because they are exposed as properties of DOM objects to JavaScript.

While there’s usually a corresponding pair of a content attribute and an IDL attribute/property, they are not necessarily interchangeable. For example, for an <option> element:

  • the content attribute selected indicates the initial state of the option (and does not change when the user changes the option),
  • the property selected reflects the current state of the control

Leave a Comment