This object does not exist in the help document, but it is indeed the core class of the entire DOM operation. The tool function $ is actually a method to call this class.
The Code is as follows:
Function $ (){
Return Selector. findChildElements (document, $ A (arguments ));
}
This class can be divided into three parts: The first part is to determine the DOM operation method used based on different browsers. Here, the Operation IE is to use the common getElementBy * series methods; FF is document. evaluate; Opera and Safari are selectorsAPI. The second part is the basic functions provided externally, such as findElements and match. Many methods in the Element object are called directly. The third part is some DOM matching criteria such as XPath. For example, what strings represent first-child queries and what strings represent nth-child queries.
Because there are many methods in this object, I will not provide all the source code. In fact, I only understand the code of some methods. Here we use a simple example based on different browsers to go through the DOM selection process. In this process, provide the required source code and describe it.
An example is as follows:
The Code is as follows: