Introduction to common HTML5 interfaces and general html5 Interfaces
1. Let's talk about several basic types: DOMString, boolean, long, unsigned long, double, NaN (Not-a-Number ). DOMString is actually a string in other commonly used languages. In HTML5, it is used to represent url, Dom content, and so on. Other boolean (boolean), long (long integer), unsigned long (unsigned long integer), and double (floating point number) I don't want to go into detail, so everyone can understand. As for NaN, I think most of the old JS birds know its meaning, that is, they are in an infinite or non-numeric value.
Undefined and null are not described in the official documents. As for why, I hope you can answer them with experts ~~ 2. Collection types include HTMLCollection, HTMLAllCollection, HTMLFormControlsCollection, HTMLOptionsCollection, and andHTMLPropertiesCollection. HTMLCollection is a generic set and is also a basic interface of the set. It provides three attributes: length, item, namedItem.
Length is the length of the set.
Item (index) can be used to obtain the elements in the set with the index value.
NamedItem (name) can be used to obtain the element with the name of the element.
In fact, you can also directly use collection [index], collection (index), collection [name], collection (name) to obtain the elements in the collection. HTMLAllCollection is inherited from the HTMLCollection interface and contains the following attributes:
The attributes of length and item are the same as those of HTMLCollection.
What distinguishes namedItem (name) from HTMLCollection is that it may return a set.
Tags (tagname) returns a set with tagname.
You can also directly use collection [index], collection (index) or collection [name], collection (name) to obtain the elements in the collection, if the value matches multiple elements, an HTMLAllCollection is returned. HTMLFormControlsCollection is a collection of form and fieldset elements. It also inherits from the HTMLCollection interface.
All attributes of HTMLCollection are available, and the RadioNodeList interface is added. It inherits from NodeList.
In fact, RadioNodeList is a set of Radiobutton by definition. I'm curious about the intention of placing such a list in HTMLFormControlsCollection. HTMLOptionsCollection is an option set inherited from the HTMLCollection interface. It is generally used to manipulate the sub-elements of the select tag.
HTMLOptionsCollection has the following attributes: add (option), remove (index), selectedIndex
The add method has two reloads.
Void add (in HTMLElement element, in optional HTMLElement before );
Void add (in HTMLElement element, in long before); the first parameter required for adding an element is optional.
Remove (index) deletes an element with an index.
SelectedIndex can be understood.