Class sHTMLCollection
Defined in: <./sHTMLCollection.js>.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
sHTMLCollection(element, items)
HTMLCollection emulation object.
|
| Field Attributes | Field Name and Description |
|---|---|
|
Number of elements.
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
sHTMLCollection.getCorrectObject(element, member, fallback)
Gets the correct object depending on the environment.
|
|
item(index)
Returns the specific node at the given zero-based
index into
the list. |
|
|
namedItem(name)
Returns the specific node whose ID or, as a fallback, name matches the
string specified by
name. |
Class Detail
sHTMLCollection(element, items)
HTMLCollection emulation object.
- Parameters:
- {Element} element
- DOM element.
- {Array} items
- Array of elements to be managed.
Field Detail
{number}
length
Number of elements.
Method Detail
<static>
{sHTMLCollection|HTMLCollection}
sHTMLCollection.getCorrectObject(element, member, fallback)
Gets the correct object depending on the environment.
- Parameters:
- {Element} element
- DOM element.
- {string} member
- Member to check for.
- {Array|NodeList} fallback
- Array or iterable object that contains elements to manage.
- Returns:
- {sHTMLCollection|HTMLCollection} The native browser object or the sHTMLCollection emulation class.
{Element|null}
item(index)
Returns the specific node at the given zero-based
index into
the list.
- Parameters:
- {number} index
- Index.
- Returns:
- {Element|null} Null if the index is out of range, element otherwise.
{Element|null}
namedItem(name)
Returns the specific node whose ID or, as a fallback, name matches the
string specified by
name. Matching by name is only done as a
last resort, only in HTML, and only if the referenced element supports the
name attribute.
- Parameters:
- {string} name
- ID or name to find.
- Returns:
- {Element|null} Element if it is found, null if no such node exists.