DOM

Provides DOM helper methods

defined in: dom.js

Namespace

Attributes

  • DOM. query {HTMLElement[]} <static> Accepts a string containing a CSS selector which is then used to match a set of elements.

Methods

  • DOM. addClass (selector, className) <static> Adds the specified class(es) to each of the set of matched elements.
  • DOM. addStyleSheet (refWin, cssText, id) <static> Creates a stylesheet from a text blob of rules.
  • DOM. appendTo (newNodes, parents, loadScripts) <static> Insert every element in the set of newNodes to the end of every element in the set of parents.
  • DOM. attr (selector, name, val, pass) <static> Get the value of an attribute for the first element in the set of matched elements.
  • DOM. children (selector, filter) <static> Get the children of the first element in the set of matched elements, optionally filtered by a filter.
  • DOM. clone (selector, deep, withDataAndEvent, deepWithDataAndEvent) <static> Create a deep copy of the first of matched elements.
  • DOM. closest (selector, filter, context, allowTextNode) <static> Get the first element that matches the filter, beginning at the first element of matched elements and progressing up through the DOM tree.
  • DOM. contains (container, contained) <static> Check to see if a DOM node is within another DOM node.
  • DOM. contents (selector, filter) <static> Get the childNodes of the first element in the set of matched elements (includes text and comment nodes), optionally filtered by a filter.
  • DOM. create (html, props, ownerDoc, _trim) <static> Creates DOM elements on the fly from the provided string of raw HTML.
  • DOM. css (selector, name, val) <static> Get the computed value of a style property for the first element in the set of matched elements.
  • DOM. data (selector, name, data) <static> If name set and data unset Store arbitrary data associated with the specified element.
  • DOM. docHeight (win) <static> Get the height of document
  • DOM. docWidth (win) <static> Get the width of document
  • DOM. empty (selector) <static> Remove(include data and event handlers) all child nodes of the set of matched elements from the DOM.
  • DOM. equals (n1, n2) <static> Check to see if a DOM node is equal with another DOM node.
  • DOM. filter (selector, filter, context) <static> Reduce the set of matched elements to those that match the selector or pass the function's test.
  • DOM. first (selector, filter, allowTextNode) <static> Get the first child of the first element in the set of matched elements.
  • DOM. get (selector, context) <static> Accepts a string containing a CSS selector which is then used to match a set of elements.
  • DOM. hasAttr (selector, name) <static> Whether one of the matched elements has specified attribute
  • DOM. hasClass (selector, className) <static> Determine whether any of the matched elements are assigned the given classes.
  • DOM. hasData (selector, name) <static> Determine whether an element has any data or specified data name associated with it.
  • DOM. hasProp (selector, name) <static> Whether one of the matched elements has specified property name
  • DOM. height (selector, value) <static> Get the current computed height for the first element in the set of matched elements.
  • DOM. hide (selector) <static> Hide the matched elements.
  • DOM. html (selector, htmlString, loadScripts, callback) <static> Get the HTML contents of the first element in the set of matched elements.
  • DOM. innerHeight (selector) <static> Get the current computed height for the first element in the set of matched elements, including padding but not border.
  • DOM. innerWidth (selector) <static> Get the current computed width for the first element in the set of matched elements, including padding but not border.
  • DOM. insertAfter (newNodes, refNodes, loadScripts) <static> Insert every element in the set of newNodes after every element in the set of refNodes.
  • DOM. insertBefore (newNodes, refNodes, loadScripts) <static> Insert every element in the set of newNodes before every element in the set of refNodes.
  • DOM. last (selector, filter, allowTextNode) <static> Get the last child of the first element in the set of matched elements.
  • DOM. next (selector, filter, allowTextNode) <static> Get the immediately following sibling of the first element in the set of matched elements.
  • DOM. offset (selector, coordinates, relativeWin) <static> Get the current coordinates of the first element in the set of matched elements, relative to the document.
  • DOM. outerHeight (selector, includeMargin) <static> Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin.
  • DOM. outerHTML (selector, htmlString, loadScripts) <static> Get the outerHTML of the first element in the set of matched elements.
  • DOM. outerWidth (selector, includeMargin) <static> Get the current computed width for the first element in the set of matched elements, including padding and border, and optionally margin.
  • DOM. parent (selector, filter, context) <static> Get the parent of the first element in the current set of matched elements, optionally filtered by a selector.
  • DOM. prependTo (newNodes, parents, loadScripts) <static> Insert every element in the set of newNodes to the beginning of every element in the set of parents.
  • DOM. prev (selector, filter, allowTextNode) <static> Get the immediately preceding sibling of the first element in the set of matched elements.
  • DOM. prop (selector, name, value) <static> Get the value of a property for the first element in the set of matched elements.
  • DOM. remove (selector, keepData) <static> Remove the set of matched elements from the DOM.
  • DOM. removeAttr (selector, name) <static> Remove an attribute from each element in the set of matched elements.
  • DOM. removeClass (selector, className) <static> Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
  • DOM. removeData (selector, name) <static> Remove a previously-stored piece of data from matched elements.
  • DOM. removeProp (selector, name) <static> Remove a property for the set of matched elements.
  • DOM. replaceClass (selector, oldClassName, newClassName) <static> Replace a class with another class for matched elements.
  • DOM. replaceWith (selector, newNodes) <static> Replace each element in the set of matched elements with the provided newNodes.
  • DOM. scrollIntoView (selector, container, top, hscroll, auto) <static> Makes the first of matched elements visible in the container
  • DOM. scrollLeft (selector, value) <static> Get the current horizontal position of the scroll bar for the first element in the set of matched elements.
  • DOM. scrollTop (selector, value) <static> Get the current vertical position of the scroll bar for the first element in the set of matched elements.
  • DOM. show (selector) <static> Display the matched elements.
  • DOM. siblings (selector, filter, allowTextNode) <static> Get the siblings of the first element in the set of matched elements, optionally filtered by a filter.
  • DOM. style (selector, name, val) <static> Get inline style property from the first element of matched elements or Set one or more CSS properties for the set of matched elements.
  • DOM. test (selector, filter, context) <static> Returns true if the matched element(s) pass the filter test
  • DOM. text (selector, val) <static> Get the combined text contents of each element in the set of matched elements, including their descendants.
  • DOM. toggle (selector) <static> Display or hide the matched elements.
  • DOM. toggleClass (selector, className, state) <static> Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
  • DOM. unique (The) <static> Sorts an array of DOM elements, in place, with the duplicates removed.
  • DOM. unselectable (selector) <static> Make matched elements unselectable
  • DOM. unwrap (wrappedNodes) <static> Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
  • DOM. val (selector, value) <static> Get the current value of the first element in the set of matched elements.
  • DOM. viewportHeight (win) <static> Get the height of window
  • DOM. viewportWidth (win) <static> Get the width of document
  • DOM. width (selector, value) <static> Get the current computed width for the first element in the set of matched elements.
  • DOM. wrap (wrappedNodes, wrapperNode) <static> Wrap a node around each element in the set of matched elements
  • DOM. wrapAll (wrappedNodes, wrapperNode) <static> Wrap a node around all elements in the set of matched elements
  • DOM. wrapInner (wrappedNodes, wrapperNode) <static> Wrap a node around the childNodes of each element in the set of matched elements.

Namespace Detail

  • DOM
    Provides DOM helper methods

Attributes Detail

  • DOM. query {HTMLElement[]} <static> Accepts a string containing a CSS selector which is then used to match a set of elements.
    Defined in:selector.js.

Methods Detail

  • DOM. addClass (selector, className) <static> view source
    Adds the specified class(es) to each of the set of matched elements.
    Defined in:class.js.
    Parameters
    • [ selector ] {HTMLElement|String|HTMLElement[]} matched elements
    •   className {String} One or more class names to be added to the class attribute of each matched element. multiple class names is separated by space
  • DOM. addStyleSheet (refWin, cssText, id) <static> view source
    Creates a stylesheet from a text blob of rules. These rules will be wrapped in a STYLE tag and appended to the HEAD of the document.
    Defined in:style.js.
    Parameters
    • [ refWin = window ] {window} Window which will accept this stylesheet
    •   cssText {String} The text containing the css rules
    • [ id ] {String} An id to add to the stylesheet for later removal
  • DOM. appendTo (newNodes, parents, loadScripts) <static> view source
    Insert every element in the set of newNodes to the end of every element in the set of parents.
    Defined in:insertion.js.
    Parameters
    •   newNodes {HTMLElement|HTMLElement[]} Nodes to be inserted
    •   parents {HTMLElement|HTMLElement[]|String} Nodes to be referred as parentNode
    •   loadScripts
  • DOM. attr (selector, name, val, pass) <static> view source
    Get the value of an attribute for the first element in the set of matched elements. or Set one or more attributes for the set of matched elements.
    Defined in:attr.js.
    Parameters
    •   selector {HTMLElement[]|HTMLElement|String|Element} matched elements
    •   name {String|Object} The name of the attribute to set. or A map of attribute-value pairs to set.
    • [ val ] A value to set for the attribute.
    •   pass
    Returns
    • {String}
  • DOM. children (selector, filter) <static> view source
    Get the children of the first element in the set of matched elements, optionally filtered by a filter.
    Defined in:traversal.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ filter ] {String|Function} Selector string or filter function
    Returns
    • {HTMLElement[]}
  • DOM. clone (selector, deep, withDataAndEvent, deepWithDataAndEvent) <static> view source
    Create a deep copy of the first of matched elements.
    Defined in:create.js.
    Parameters
    • [ selector ] {HTMLElement|String|HTMLElement[]} matched elements
    • [ deep = false ] {Boolean|Object} whether perform deep copy or copy config.
    • [ deep.deep ] {Boolean} whether perform deep copy
    • [ deep.withDataAndEvent = false ] {Boolean} A Boolean indicating whether event handlers and data should be copied along with the elements.
    • [ deep.deepWithDataAndEvent = false ] {Boolean} A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. if set true then deep argument must be set true as well.
    • [ withDataAndEvent = false ] {Boolean} A Boolean indicating whether event handlers and data should be copied along with the elements.
    • [ deepWithDataAndEvent = false ] {Boolean} A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. if set true then deep argument must be set true as well.
    Returns
    • {HTMLElement}
    See
    • https://developer.mozilla.org/En/DOM/Node.cloneNode
  • DOM. closest (selector, filter, context, allowTextNode) <static> view source
    Get the first element that matches the filter, beginning at the first element of matched elements and progressing up through the DOM tree.
    Defined in:traversal.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    •   filter {String|Function} Selector string or filter function
    • [ context ] {HTMLElement|String|Document|HTMLElement[]} Search bound element
    •   allowTextNode
    Returns
    • {HTMLElement}
  • DOM. contains (container, contained) <static> view source
    Check to see if a DOM node is within another DOM node.
    Defined in:traversal.js.
    Parameters
    •   container {HTMLElement|String|Element} The DOM element that may contain the other element.
    •   contained {HTMLElement|String|Element} The DOM element that may be contained by the other element.
    Returns
    • {Boolean}
  • DOM. contents (selector, filter) <static> view source
    Get the childNodes of the first element in the set of matched elements (includes text and comment nodes), optionally filtered by a filter.
    Defined in:traversal.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ filter ] {String|Function} Selector string or filter function
    Returns
    • {Node[]}
  • DOM. create (html, props, ownerDoc, _trim) <static> view source
    Creates DOM elements on the fly from the provided string of raw HTML.
    Defined in:create.js.
    Parameters
    •   html {String} A string of HTML to create on the fly. Note that this parses HTML, not XML.
    • [ props ] {Object} An map of attributes on the newly-created element.
    • [ ownerDoc ] {Document} A document in which the new elements will be created
    •   _trim
    Returns
    • {DocumentFragment|HTMLElement}
  • DOM. css (selector, name, val) <static> view source
    Get the computed value of a style property for the first element in the set of matched elements. or Set one or more CSS properties for the set of matched elements.
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement|Element} 选择器或节点或节点数组
    •   name {String|Object} A CSS property. or A map of property-value pairs to set.
    • [ val ] A value to set for the property.
    Returns
    • {undefined|String}
  • DOM. data (selector, name, data) <static> view source
    If name set and data unset Store arbitrary data associated with the specified element. Returns undefined. or If name set and data unset returns value at named data store for the element or If name unset and data unset returns the full data store for the element.
    Defined in:data.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ name ] {String} A string naming the piece of data to set.
    • [ data ] The new data value.
    Returns
    • {Object|undefined}
  • DOM. docHeight (win) <static> view source
    Get the height of document
    Defined in:offset.js.
    Parameters
    • [ win = window ] {window} Window to be referred.
  • DOM. docWidth (win) <static> view source
    Get the width of document
    Defined in:offset.js.
    Parameters
    • [ win = window ] {window} Window to be referred.
  • DOM. empty (selector) <static> view source
    Remove(include data and event handlers) all child nodes of the set of matched elements from the DOM.
    Defined in:create.js.
    Parameters
    • [ selector ] {HTMLElement|String|HTMLElement[]} matched elements
  • DOM. equals (n1, n2) <static> view source
    Check to see if a DOM node is equal with another DOM node.
    Defined in:traversal.js.
    Parameters
    •   n1 {HTMLElement|String|Element}
    •   n2 {HTMLElement|String|Element}
    Returns
    • {Boolean}
  • DOM. filter (selector, filter, context) <static> view source
    Reduce the set of matched elements to those that match the selector or pass the function's test.
    Defined in:selector.js.
    Parameters
    •   selector {String|HTMLElement[]|NodeList} Matched elements
    •   filter {String|Function} Selector string or filter function
    • [ context ] {String|HTMLElement[]|Document} Context under which to find matched elements
    Returns
    • {HTMLElement[]}
  • DOM. first (selector, filter, allowTextNode) <static> view source
    Get the first child of the first element in the set of matched elements. If a filter is provided, it retrieves the next child only if it matches that filter.
    Defined in:traversal.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ filter ] {String|Function} Selector string or filter function
    •   allowTextNode
    Returns
    • {HTMLElement}
  • DOM. get (selector, context) <static> view source
    Accepts a string containing a CSS selector which is then used to match a set of elements.
    Defined in:selector.js.
    Parameters
    •   selector {String|HTMLElement[]} A string containing a selector expression. or array of HTMLElements.
    • [ context ] {String|HTMLElement[]|Document|HTMLElement|window} context under which to find elements matching selector.
    Returns
    • {HTMLElement} The first of found HTMLElements
  • DOM. hasAttr (selector, name) <static> view source
    Whether one of the matched elements has specified attribute
    Defined in:attr.js.
    Parameters
    •   selector {Array|String} matched elements
    •   name {String} The attribute to be tested
    Returns
    • {Boolean}
  • DOM. hasClass (selector, className) <static> view source
    Determine whether any of the matched elements are assigned the given classes.
    Defined in:class.js.
    Parameters
    • [ selector ] {HTMLElement|String|HTMLElement[]} matched elements
    •   className {String} One or more class names to search for. multiple class names is separated by space
    Returns
    • {Boolean}
  • DOM. hasData (selector, name) <static> view source
    Determine whether an element has any data or specified data name associated with it.
    Defined in:data.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ name ] {String} A string naming the piece of data to set.
    Returns
    • {Boolean}
  • DOM. hasProp (selector, name) <static> view source
    Whether one of the matched elements has specified property name
    Defined in:attr.js.
    Parameters
    •   selector {Array|String|HTMLElement} 元素
    •   name {String} The name of property to test
    Returns
    • {Boolean}
  • DOM. height (selector, value) <static> view source
    Get the current computed height for the first element in the set of matched elements. or Set the CSS height of each element in the set of matched elements.
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ value ] {String|Number} An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
    Returns
    • {Number|undefined}
  • DOM. hide (selector) <static> view source
    Hide the matched elements.
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements.
  • DOM. html (selector, htmlString, loadScripts, callback) <static> view source
    Get the HTML contents of the first element in the set of matched elements. or Set the HTML contents of each element in the set of matched elements.
    Defined in:create.js.
    Parameters
    • [ selector ] {HTMLElement|String|HTMLElement[]} matched elements
    •   htmlString {String} A string of HTML to set as the content of each matched element.
    • [ loadScripts = false ] {Boolean} True to look for and process scripts
    •   callback
  • DOM. innerHeight (selector) <static> view source
    Get the current computed height for the first element in the set of matched elements, including padding but not border.
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    Returns
    • {Number}
  • DOM. innerWidth (selector) <static> view source
    Get the current computed width for the first element in the set of matched elements, including padding but not border.
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    Returns
    • {Number}
  • DOM. insertAfter (newNodes, refNodes, loadScripts) <static> view source
    Insert every element in the set of newNodes after every element in the set of refNodes.
    Defined in:insertion.js.
    Parameters
    •   newNodes {HTMLElement|HTMLElement[]} Nodes to be inserted
    •   refNodes {HTMLElement|HTMLElement[]|String} Nodes to be referred
    •   loadScripts
  • DOM. insertBefore (newNodes, refNodes, loadScripts) <static> view source
    Insert every element in the set of newNodes before every element in the set of refNodes.
    Defined in:insertion.js.
    Parameters
    •   newNodes {HTMLElement|HTMLElement[]} Nodes to be inserted
    •   refNodes {HTMLElement|HTMLElement[]|String} Nodes to be referred
    •   loadScripts
  • DOM. last (selector, filter, allowTextNode) <static> view source
    Get the last child of the first element in the set of matched elements. If a filter is provided, it retrieves the previous child only if it matches that filter.
    Defined in:traversal.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ filter ] {String|Function} Selector string or filter function
    •   allowTextNode
    Returns
    • {HTMLElement}
  • DOM. next (selector, filter, allowTextNode) <static> view source
    Get the immediately following sibling of the first element in the set of matched elements. If a filter is provided, it retrieves the next child only if it matches that filter.
    Defined in:traversal.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ filter ] {String|Function} Selector string or filter function
    •   allowTextNode
    Returns
    • {HTMLElement}
  • DOM. offset (selector, coordinates, relativeWin) <static> view source
    Get the current coordinates of the first element in the set of matched elements, relative to the document. or Set the current coordinates of every element in the set of matched elements, relative to the document.
    Defined in:offset.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ coordinates ] {Object} An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
    • [ coordinates.left ] {Number} the new top and left coordinates for the elements.
    • [ coordinates.top ] {Number} the new top and top coordinates for the elements.
    • [ relativeWin ] {window} The window to measure relative to. If relativeWin is not in the ancestor frame chain of the element, we measure relative to the top-most window.
    Returns
    • {Object|undefined} if Get, the format of returned value is same with coordinates.
  • DOM. outerHeight (selector, includeMargin) <static> view source
    Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin.
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ includeMargin ] {Boolean} A Boolean indicating whether to include the element's margin in the calculation.
    Returns
    • {Number}
  • DOM. outerHTML (selector, htmlString, loadScripts) <static> view source
    Get the outerHTML of the first element in the set of matched elements. or Set the outerHTML of each element in the set of matched elements.
    Defined in:create.js.
    Parameters
    • [ selector ] {HTMLElement|String|HTMLElement[]} matched elements
    •   htmlString {String} A string of HTML to set as outerHTML of each matched element.
    • [ loadScripts = false ] {Boolean} True to look for and process scripts
  • DOM. outerWidth (selector, includeMargin) <static> view source
    Get the current computed width for the first element in the set of matched elements, including padding and border, and optionally margin.
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ includeMargin ] {Boolean} A Boolean indicating whether to include the element's margin in the calculation.
    Returns
    • {Number}
  • DOM. parent (selector, filter, context) <static> view source
    Get the parent of the first element in the current set of matched elements, optionally filtered by a selector.
    Defined in:traversal.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ filter ] {String|Function} Selector string or filter function
    • [ context ] {HTMLElement|String|Document|HTMLElement[]} Search bound element
    Returns
    • {HTMLElement}
  • DOM. prependTo (newNodes, parents, loadScripts) <static> view source
    Insert every element in the set of newNodes to the beginning of every element in the set of parents.
    Defined in:insertion.js.
    Parameters
    •   newNodes {HTMLElement|HTMLElement[]} Nodes to be inserted
    •   parents {HTMLElement|HTMLElement[]|String} Nodes to be referred as parentNode
    •   loadScripts
  • DOM. prev (selector, filter, allowTextNode) <static> view source
    Get the immediately preceding sibling of the first element in the set of matched elements. If a filter is provided, it retrieves the previous child only if it matches that filter.
    Defined in:traversal.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ filter ] {String|Function} Selector string or filter function
    •   allowTextNode
    Returns
    • {HTMLElement}
  • DOM. prop (selector, name, value) <static> view source
    Get the value of a property for the first element in the set of matched elements. or Set one or more properties for the set of matched elements.
    Defined in:attr.js.
    Parameters
    •   selector {Array|String|HTMLElement} matched elements
    •   name {String|Object} The name of the property to set. or A map of property-value pairs to set.
    • [ value ] A value to set for the property.
    Returns
    • {String|undefined|Boolean}
  • DOM. remove (selector, keepData) <static> view source
    Remove the set of matched elements from the DOM.
    Defined in:create.js.
    Parameters
    • [ selector ] {HTMLElement|String|HTMLElement[]} matched elements
    • [ keepData = false ] {Boolean} whether keep bound events and jQuery data associated with the elements from removed.
  • DOM. removeAttr (selector, name) <static> view source
    Remove an attribute from each element in the set of matched elements.
    Defined in:attr.js.
    Parameters
    •   selector {Array|String} matched elements
    •   name {String} An attribute to remove
  • DOM. removeClass (selector, className) <static> view source
    Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
    Defined in:class.js.
    Parameters
    • [ selector ] {HTMLElement|String|HTMLElement[]} matched elements
    •   className {String} One or more class names to be removed from the class attribute of each matched element. multiple class names is separated by space
  • DOM. removeData (selector, name) <static> view source
    Remove a previously-stored piece of data from matched elements. or Remove all data from matched elements if name unset.
    Defined in:data.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ name ] {String} A string naming the piece of data to delete.
  • DOM. removeProp (selector, name) <static> view source
    Remove a property for the set of matched elements.
    Defined in:attr.js.
    Parameters
    •   selector {Array|String|HTMLElement} matched elements
    •   name {String} The name of the property to remove.
  • DOM. replaceClass (selector, oldClassName, newClassName) <static> view source
    Replace a class with another class for matched elements. If no oldClassName is present, the newClassName is simply added.
    Defined in:class.js.
    Parameters
    • [ selector ] {HTMLElement|String|HTMLElement[]} matched elements
    •   oldClassName {String} One or more class names to be removed from the class attribute of each matched element. multiple class names is separated by space
    •   newClassName {String} One or more class names to be added to the class attribute of each matched element. multiple class names is separated by space
  • DOM. replaceWith (selector, newNodes) <static> view source
    Replace each element in the set of matched elements with the provided newNodes.
    Defined in:insertion.js.
    Parameters
    •   selector {HTMLElement|HTMLElement[]|String} set of matched elements
    •   newNodes {HTMLElement|HTMLElement[]|String} new nodes to replace the matched elements
  • DOM. scrollIntoView (selector, container, top, hscroll, auto) <static> view source
    Makes the first of matched elements visible in the container
    Defined in:offset.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ container = window ] {String|HTMLElement|Document} Container element
    • [ top = true ] {Boolean} Whether align with top of container.
    • [ hscroll = true ] {Boolean} Whether trigger horizontal scroll.
    • [ auto = false ] {Boolean} Whether adjust element automatically (only scrollIntoView when element is out of view)
    See
    • http://www.w3.org/TR/2009/WD-html5-20090423/editing.html#scrollIntoView http://www.sencha.com/deploy/dev/docs/source/Element.scroll-more.html#scrollIntoView http://yiminghe.javaeye.com/blog/390732
  • DOM. scrollLeft (selector, value) <static> view source
    Get the current horizontal position of the scroll bar for the first element in the set of matched elements. or Set the current horizontal position of the scroll bar for each of the set of matched elements.
    Defined in:offset.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement|window} matched elements
    •   value {Number} An integer indicating the new position to set the scroll bar to.
  • DOM. scrollTop (selector, value) <static> view source
    Get the current vertical position of the scroll bar for the first element in the set of matched elements. or Set the current vertical position of the scroll bar for each of the set of matched elements.
    Defined in:offset.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement|window} matched elements
    •   value {Number} An integer indicating the new position to set the scroll bar to.
  • DOM. show (selector) <static> view source
    Display the matched elements.
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements.
  • DOM. siblings (selector, filter, allowTextNode) <static> view source
    Get the siblings of the first element in the set of matched elements, optionally filtered by a filter.
    Defined in:traversal.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ filter ] {String|Function} Selector string or filter function
    •   allowTextNode
    Returns
    • {HTMLElement[]}
  • DOM. style (selector, name, val) <static> view source
    Get inline style property from the first element of matched elements or Set one or more CSS properties for the set of matched elements.
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    •   name {String|Object} A CSS property. or A map of property-value pairs to set.
    • [ val ] A value to set for the property.
    Returns
    • {undefined|String}
  • DOM. test (selector, filter, context) <static> view source
    Returns true if the matched element(s) pass the filter test
    Defined in:selector.js.
    Parameters
    •   selector {String|HTMLElement[]} Matched elements
    •   filter {String|Function} Selector string or filter function
    • [ context ] {String|HTMLElement[]|Document} Context under which to find matched elements
    Returns
    • {Boolean}
  • DOM. text (selector, val) <static> view source
    Get the combined text contents of each element in the set of matched elements, including their descendants. or Set the content of each element in the set of matched elements to the specified text.
    Defined in:attr.js.
    Parameters
    •   selector {HTMLElement[]|HTMLElement|String} matched elements
    • [ val ] {String} A string of text to set as the content of each matched element.
    Returns
    • {String|undefined}
  • DOM. toggle (selector) <static> view source
    Display or hide the matched elements.
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements.
  • DOM. toggleClass (selector, className, state) <static> view source
    Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
    Defined in:class.js.
    Parameters
    • [ selector ] {HTMLElement|String|HTMLElement[]} matched elements
    •   className {String} One or more class names to be added to the class attribute of each matched element. multiple class names is separated by space
    • [ state ] {Boolean} optional boolean to indicate whether class should be added or removed regardless of current state.
  • DOM. unique (The) <static> view source
    Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
    Defined in:selector.js.
    Parameters
    •   The {HTMLElement[]} Array of DOM elements.
    Returns
    • {HTMLElement[]}
  • DOM. unselectable (selector) <static> view source
    Make matched elements unselectable
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements.
  • DOM. unwrap (wrappedNodes) <static> view source
    Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
    Defined in:insertion.js.
    Parameters
    •   wrappedNodes {HTMLElement|HTMLElement[]|String} set of matched elements
  • DOM. val (selector, value) <static> view source
    Get the current value of the first element in the set of matched elements. or Set the value of each element in the set of matched elements.
    Defined in:attr.js.
    Parameters
    •   selector {Array|String} matched elements
    • [ value ] {String|Array} A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked.
    Returns
    • {undefined|String|Array|Number}
  • DOM. viewportHeight (win) <static> view source
    Get the height of window
    Defined in:offset.js.
    Parameters
    • [ win = window ] {window} Window to be referred.
  • DOM. viewportWidth (win) <static> view source
    Get the width of document
    Defined in:offset.js.
    Parameters
    • [ win = window ] {window} Window to be referred.
  • DOM. width (selector, value) <static> view source
    Get the current computed width for the first element in the set of matched elements. or Set the CSS width of each element in the set of matched elements.
    Defined in:style.js.
    Parameters
    •   selector {HTMLElement[]|String|HTMLElement} Matched elements
    • [ value ] {String|Number} An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
    Returns
    • {Number|undefined}
  • DOM. wrap (wrappedNodes, wrapperNode) <static> view source
    Wrap a node around each element in the set of matched elements
    Defined in:insertion.js.
    Parameters
    •   wrappedNodes {HTMLElement|HTMLElement[]|String} set of matched elements
    •   wrapperNode {HTMLElement|String} html node or selector to get the node wrapper
  • DOM. wrapAll (wrappedNodes, wrapperNode) <static> view source
    Wrap a node around all elements in the set of matched elements
    Defined in:insertion.js.
    Parameters
    •   wrappedNodes {HTMLElement|HTMLElement[]|String} set of matched elements
    •   wrapperNode {HTMLElement|String} html node or selector to get the node wrapper
  • DOM. wrapInner (wrappedNodes, wrapperNode) <static> view source
    Wrap a node around the childNodes of each element in the set of matched elements.
    Defined in:insertion.js.
    Parameters
    •   wrappedNodes {HTMLElement|HTMLElement[]|String} set of matched elements
    •   wrapperNode {HTMLElement|String} html node or selector to get the node wrapper
blog comments powered by Disqus
Top