I just stumbled across something like this...
function(element) {
...
var attributes = element.attributes;
for (var index = 0, length = attributes.length; index < length; index++) {
var attribute = attributes[index];
// what is ".specified"?
if (attribute.specified) {
...
}
}
}
I'm looking at the W3C specs for a DOM Element, the Element interface, and I don't see specified
anywhere.
http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-745549614
What does attribute.specified
mean? What does it represent? Where is it defined in the specs?
<img src="kittens.jpg">
. the attribute is src
, and its value is kittens.jpg
. DOM elements are generic definitions. the actual attributes are specified by the actual language being used, e.g. XML, HTML, etc....
specified = the attribute has an explicit value assigned to it. e.g. the src attribute is specified, because it's been given the value kittens.jpg, but
<input type="checkbox" checked />
the checked attribute is PRESENT, but not SPECIFIED.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With