This specification is like no other — it has been processed with you, the humble web developer, in mind.
The focus of this specification is readability and ease of access. Unlike the full HTML Standard, this "developer's edition" removes information that only browser vendors need know. It is automatically produced from the full specification by our build tooling, and thus always in sync with the latest developments in HTML.
To read about its conception, construction, and future, read the original press release, and the blog post about its relaunch.
Finally, feel free to contribute on GitHub to make this edition better for everyone!
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.
The HTMLFormControlsCollection
and HTMLOptionsCollection
interfaces
are collections derived from the
HTMLCollection
interface. The HTMLAllCollection
interface is a collection, but is not so derived.
HTMLAllCollection
interfaceThe HTMLAllCollection
interface is used for the legacy document.all
attribute. It operates similarly to
HTMLCollection
; the main differences are that it allows a staggering variety of
different (ab)uses of its methods to all end up returning something, and that it can be called as
a function as an alternative to property access.
All HTMLAllCollection
objects are rooted at a Document
and have a filter that matches all elements, so the elements represented by the
collection of an HTMLAllCollection
object consist of all the descendant
elements of the root Document
.
length
Returns the number of elements in the collection.
item
(index)Returns the item with index index from the collection (determined by tree order).
item
(name)item
(name)namedItem
(name)namedItem
(name)Returns the item with ID or name name from the collection.
If there are multiple matching items, then an HTMLCollection
object containing all those elements is returned.
Only button
, form
, iframe
,
input
, map
, meta
, object
,
select
, and textarea
elements can have a name for the purpose of this
method; their name is given by the value of their name
attribute.
HTMLFormControlsCollection
interfaceThe HTMLFormControlsCollection
interface is used for
collections of listed
elements in form
elements.
length
Returns the number of elements in the collection.
item
(index)Returns the item with index index from the collection. The items are sorted in tree order.
namedItem
(name)namedItem
(name)Returns the item with ID or name
name from the collection.
If there are multiple matching items, then a RadioNodeList
object containing all those elements is returned.
Returns the value of the first checked radio button represented by the object.
Can be set, to check the first radio button with the given value represented by the object.
HTMLOptionsCollection
interfaceThe HTMLOptionsCollection
interface is used for collections of option
elements. It is always
rooted on a select
element and has attributes and methods that manipulate that
element's descendants.
length
[ = value ]Returns the number of elements in the collection.
When set to a smaller number, truncates the number of option
elements in the corresponding container.
When set to a greater number, adds new blank option
elements to that container.
item
(index)Returns the item with index index from the collection. The items are sorted in tree order.
When index is a greater number than the number of items in the collection, adds
new blank option
elements in the corresponding container.
When set to null, removes the item at index index from the collection.
When set to an option
element, adds or replaces it at index index
from the collection.
namedItem
(name)Returns the item with ID or name
name from the collection.
If there are multiple matching items, then the first is returned.
add
(element [, before ] )Inserts element before the node given by before.
The before argument can be a number, in which case element is inserted before the item with that number, or an element from the collection, in which case element is inserted before that element.
If before is omitted, null, or a number out of range, then element will be added at the end of the list.
This method will throw a "HierarchyRequestError
" DOMException
if
element is an ancestor of the element into which it is to be inserted.
remove
(index)Removes the item with index index from the collection.
selectedIndex
[ = value ]Returns the index of the first selected item, if any, or −1 if there is no selected item.
Can be set, to change the selection.
DOMStringList
interfaceThe DOMStringList
interface is a non-fashionable retro way of representing a list
of strings.
length
Returns the number of strings in strings.
item
(index)Returns the string with index index from strings.
contains
(string)Returns true if strings contains string, and false otherwise.