DOM (Document Object Model) Adapter Module for Base Library
Eric Bréchemier © 2011, Some Rights Reserved Legal-Box SAS © 2010-2011, All Rights Reserved
BSD License http://creativecommons.org/licenses/BSD/
2011-08-14
lb. | DOM (Document Object Model) Adapter Module for Base Library |
Functions | |
$(id): DOM Element | An alias for document.getElementById(id). |
hasAttribute(element, attributeName): boolean | Check whether an attribute with given name has been specified on given element. |
Constants | |
ELEMENT_NODE | The nodeType value of element nodes: 1. |
ATTRIBUTE_NODE | The nodeType value of attribute nodes: 2. |
TEXT_NODE | The nodeType value of text nodes: 3. |
An alias for document.getElementById(id).
id | string, the identifier of an HTML element |
DOM Element, the element with given id, if present in the document, null otherwise
”Behavior is not defined if more than one element has this ID”
DOM Level 2 Core http://www.w3.org
Check whether an attribute with given name has been specified on given element.
The native hasAttribute() function is used when available. When missing, it is emulated by checking DOM level 2 property ‘specified’ of the attribute node.
element | DOM Element, the element to check for given attribute |
attributeName | string, an attribute name |
When the behavior is emulated, in IE, the attribute may not have been defined in the original document or through JavaScript, but may be an optional attribute set to its default value.
Adapted from bezen.dom.hasAttribute() in bezen.org JavaScript library, CC-BY: Eric Bréchemier - http://bezen.org/javascript/
hasAttribute | introduced in DOM Level 2 http://www.w3.org |
specified | Interface Attr http://www.w3.org |