Home  >  Article  >  Web Front-end  >  Summary of which attributes and methods of document and window are used in jQuery_jquery

Summary of which attributes and methods of document and window are used in jQuery_jquery

WBOY
WBOYOriginal
2016-05-16 18:02:161058browse

document.activeElement

Gets the currently focused element of the document

document.head

is used in jQuery as follows document.head || document.getElementsByTagName( "head" )[0]. It can be seen that not all browsers support it.

document.body

Get the HTMLBodyElement element of the current document

document.compatMode

Get the rendering mode of the current document. Return values: BackCompat (quirks mode) and CSS1Compat (standards mode).

Since IE 8 has as many as five rendering modes, determining whether it is a quirk mode requires additional detection with the help of IE’s unique document.documentMode

See this article http://www.jb51.net/article/21717.htm

document.readySate

Returns the loading status of the document: uninitialized, loading, loaded, interactive, complete. All browsers support this attribute (supported by FF3.6 and above).

In standard browsers, ordinary HTML elements do not have this attribute (except Opera's script tag).

The ready function in jQuery uses the complete status value to determine whether the DOM tree is loaded

document.documentElement

returns the document root element (HTMLHtmlElement)

document.documentElement.currentStyle

IE unique method to obtain element style

document.documentElement.contains()

Special for IE, used to determine whether the document contains the specified node element

document.documentElement.compareDocumentPosition()

Compare the document position of the current node with the specified node IE9 supports this method

For detailed information, see http://www.jb51.net/article/28281.htm

document.documentElement.doScroll()

IE unique method, simulates user scroll bar click; jQuery uses this method to detect whether the DOM tree is available in IE6.

Non-IE can use obj.scrollTop =10; applicable elements include html, body, div, span, textarea, etc.

For more information, see http://msdn.microsoft.com/en-us/library/ms536414(VS.85).aspx

document.defaultView (DOMWindow)

Returns the window object associated with the current document or null. IE 9 supports this attribute

document.defaultView.getComputedStyle()

Get element style information (non-inline) and return the style sheet object. W3C standard method; IE corresponds to the currentStyle attribute

window.frameElement

Get the host node iframe element of the current document

window.location

returns the URL information of the current document

window.execScript()

The execScript function has the same function as eval. The difference is that the scope of the script after the eval function is executed is the current execution context, while execScript always targets the global scope.

The functions of eval and window.eval in IE are the same. The script scope executed by window.eval is also the current execution context.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn