IOS developmentAboutCommon HTML5 InterfacesThe introduction is the content to be introduced in this article.Common HTML5 excusesFor details, see the details. I have been very busy recently. I have already had ideas but I have never been able to finish this article. Let's take a moment to summarize some things.
1. Let's talk about several basic types: DOMString, boolean, long, unsigned long, double, NaNNot-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), long integer), unsigned long integer), double Floating Point Number) I don't want to go into detail, you 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 HTMLPropertiesCollection。
HTMLCollection is a generic set and a basic interface of the set. It provides three bubutes:
- length, item, namedItem.
Length is the length of the set.
Itemindex) You can use the index value to obtain the elements in the set.
NamedItemname) You can use the name of an element to obtain the element.
In fact, you can also directly use collection [index], collectionindex) or collection [name], collectionname) 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.
Different from HTMLCollection, namedItemname may return a set.
Tagstagname) returns a set with tagname.
You can also directly use collection [index], collectionindex) or collection [name], collectionname) to obtain the elements in the set. When the value matches multiple elements,
HTMLAllCollection.
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.
The unique attributes of HTMLOptionsCollection include addoption and removeindex. The selectedIndex add method has two overloading methods.
- void add(in HTMLElement element, in optional HTMLElement before);
- void add(in HTMLElement element, in long before);
The first parameter is required for adding an element, and the following parameters are optional.
Removeindex) to delete an element.
SelectedIndex can be understood.
Summary:IOS developmentAboutCommon HTML5 InterfacesThe introduction is complete. I hope this article will help you!