While reading over the WHATWG’s HTML5 – A technical specification for Web developers I see many references such as:
Reflecting content attributes in IDL attributes
Some IDL attributes are defined to reflect a particular content
attribute. This means that on getting, the IDL attribute returns the
current value of the content attribute, and on setting, the IDL
attribute changes the value of the content attribute to the given
value.
and:
In conforming documents, there is only one body element. The
document.body IDL attribute provides scripts with easy access to a
document’s body element.The body element exposes as event handler content attributes a number
of the event handlers of the Window object. It also mirrors their
event handler IDL attributes.
My (admittedly fuzzy) understanding comes from the Windows world. I think an .idl file is used to map remote procedure calls in an n-tier distributed app. I would assume a content attribute refers to html element attributes.
There is no place in the standard that I can see that explains this usage of the terms “content attribute” and “IDL attribute”. Could anyone explain what these terms mean and how the two kinds of attributes relate?
The IDL (Interface Definition Language) comes from the Web IDL spec:
Content attributes are the ones that appear in the markup:
In the above code
idandclassare attributes. Usually a content attribute will have a corresponding IDL attribute.For example, the following JavaScript:
Is equivalent to setting the
classcontent 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:selectedindicates the initial state of the option (and does not change when the user changes the option),selectedreflects the current state of the control