Ext.data.JsonP.Ext_dom_Query({"alternateClassNames":["Ext.DomQuery","Ext.core.DomQuery"],"aliases":{},"enum":null,"parentMixins":[],"tagname":"class","subclasses":[],"extends":null,"uses":[],"html":"

Alternate names

Ext.DomQuery
Ext.core.DomQuery

Files

Provides high performance selector/xpath processing by compiling queries into reusable functions. New pseudo classes\nand matchers can be plugged. It works on HTML and XML documents (if a content node is passed in).

\n\n

DomQuery supports most of the CSS3 selectors spec, along with some custom selectors and basic XPath.

\n\n

All selectors, attribute filters and pseudos below can be combined infinitely in any order. For example\ndiv.foo:nth-child(odd)[@foo=bar].bar:first would be a perfectly valid selector. Node filters are processed\nin the order in which they appear, which allows you to optimize your queries for your document structure.

\n\n

Element Selectors:

\n\n\n\n\n

Attribute Selectors:

\n\n

The use of @ and quotes are optional. For example, div[@foo='bar'] is also a valid attribute selector.

\n\n\n\n\n

Pseudo Classes:

\n\n\n\n\n

CSS Value Selectors:

\n\n\n\n\n

XML Namespaces:

\n\n\n\n
Defined By

Properties

Collection of matching regular expressions and code snippets. ...

Collection of matching regular expressions and code snippets.\nEach capture group within () will be replace the {} in the select\nstatement as specified by their index.

\n
Collection of operator comparison functions. ...

Collection of operator comparison functions.\nThe default operators are =, !=, ^=, $=, *=, %=, |= and ~=.

\n\n

New operators can be added as long as the match the format c= where c\nis any character other than space, >, or <.

\n\n

Operator functions are passed the following parameters:

\n\n
    \n
  • propValue : The property value to test.
  • \n
  • compareTo : The value to compare to.
  • \n
\n\n
Ext.dom.Query
view source
: Object
Object hash of \"pseudo class\" filter functions which are used when filtering selections. ...

Object hash of \"pseudo class\" filter functions which are used when filtering selections.\nEach function is passed two parameters:

\n\n
    \n
  • c : Array\n An Array of DOM elements to filter.

  • \n
  • v : String\n The argument (if any) supplied in the selector.

  • \n
\n\n\n

A filter function returns an Array of DOM elements which conform to the pseudo class.\nIn addition to the provided pseudo classes listed above such as first-child and nth-child,\ndevelopers may add additional, custom psuedo class filters to select elements according to application-specific requirements.

\n\n

For example, to filter a elements to only return links to external resources:

\n\n
Ext.DomQuery.pseudos.external = function(c, v) {\n    var r = [], ri = -1;\n    for(var i = 0, ci; ci = c[i]; i++) {\n        // Include in result set only if it's a link to an external resource\n        if (ci.hostname != location.hostname) {\n            r[++ri] = ci;\n        }\n    }\n    return r;\n};\n
\n\n

Then external links could be gathered with the following statement:

\n\n
var externalLinks = Ext.select(\"a:external\");\n
\n
Defined By

Methods

Ext.dom.Query
view source
( selector, [type] ) : Function
Compiles a selector/xpath query into a reusable function. ...

Compiles a selector/xpath query into a reusable function. The returned function\ntakes one parameter \"root\" (optional), which is the context node from where the query should start.

\n

Parameters

  • selector : String

    The selector/xpath query

    \n
  • type : String (optional)

    Either \"select\" or \"simple\" for a simple selector match

    \n

    Defaults to: "select"

Returns

Ext.dom.Query
view source
( el, selector, nonMatches ) : HTMLElement[]
Filters an array of elements to only include matches of a simple selector\n(e.g. ...

Filters an array of elements to only include matches of a simple selector\n(e.g. div.some-class or span:first-child)

\n

Parameters

  • el : HTMLElement[]

    An array of elements to filter

    \n
  • selector : String

    The simple selector to test

    \n
  • nonMatches : Boolean

    If true, it returns the elements that DON'T match the selector instead of the\nones that match

    \n

Returns

  • HTMLElement[]

    An Array of DOM elements which match the selector. If there are no matches, and empty\nArray is returned.

    \n
Ext.dom.Query
view source
( el, selector ) : Boolean
Returns true if the passed element(s) match the passed simple selector\n(e.g. ...

Returns true if the passed element(s) match the passed simple selector\n(e.g. div.some-class or span:first-child)

\n

Parameters

  • el : String/HTMLElement/HTMLElement[]

    An element id, element or array of elements

    \n
  • selector : String

    The simple selector to test

    \n

Returns

Ext.dom.Query
view source
( selector, [root] ) : HTMLElement[]
Selects an array of DOM nodes using JavaScript-only implementation. ...

Selects an array of DOM nodes using JavaScript-only implementation.

\n\n

Use select to take advantage of browsers built-in support for CSS selectors.

\n

Parameters

  • selector : String

    The selector/xpath query (can be a comma separated list of selectors)

    \n
  • root : HTMLElement/String (optional)

    The start of the query.

    \n

    Defaults to: document

Returns

  • HTMLElement[]

    An Array of DOM elements which match the selector. If there are\nno matches, and empty Array is returned.

    \n
Ext.dom.Query
view source
( path, [root], [type], [single] ) : HTMLElement[]
Selects an array of DOM nodes by CSS/XPath selector. ...

Selects an array of DOM nodes by CSS/XPath selector.

\n\n

Uses document.querySelectorAll if browser supports that, otherwise falls back to\njsSelect to do the work.

\n\n

Aliased as Ext.query.

\n

Parameters

  • path : String

    The selector/xpath query

    \n\n
  • root : HTMLElement (optional)

    The start of the query.

    \n\n

    Defaults to: document

  • type : String (optional)

    Either \"select\" or \"simple\" for a simple selector match (only valid when\nused when the call is deferred to the jsSelect method)

    \n\n

    Defaults to: "select"

  • single : Boolean (optional)

    Pass true to select only the first matching node using document.querySelector (where available)

    \n\n

Returns

  • HTMLElement[]

    An array of DOM elements (not a NodeList as returned by querySelectorAll).

    \n\n
Ext.dom.Query
view source
( selector, [root] ) : HTMLElement
Selects a single element. ...

Selects a single element.

\n

Parameters

  • selector : String

    The selector/xpath query

    \n
  • root : HTMLElement (optional)

    The start of the query.

    \n

    Defaults to: document

Returns

  • HTMLElement

    The DOM element which matched the selector.

    \n
Ext.dom.Query
view source
( selector, [root], [defaultValue] ) : Number
Selects the value of a node, parsing integers and floats. ...

Selects the value of a node, parsing integers and floats.\nReturns the defaultValue, or 0 if none is specified.

\n

Parameters

  • selector : String

    The selector/xpath query

    \n
  • root : HTMLElement (optional)

    The start of the query.

    \n

    Defaults to: document

  • defaultValue : Number (optional)

    When specified, this is return as empty value.

    \n

Returns

Ext.dom.Query
view source
( selector, [root], [defaultValue] ) : String
Selects the value of a node, optionally replacing null with the defaultValue. ...

Selects the value of a node, optionally replacing null with the defaultValue.

\n

Parameters

  • selector : String

    The selector/xpath query

    \n
  • root : HTMLElement (optional)

    The start of the query.

    \n

    Defaults to: document

  • defaultValue : String (optional)

    When specified, this is return as empty value.

    \n

Returns

","superclasses":[],"meta":{},"requires":[],"html_meta":{},"statics":{"property":[],"cfg":[],"css_var":[],"method":[],"event":[],"css_mixin":[]},"files":[{"href":"Query.html#Ext-dom-Query","filename":"Query.js"}],"linenr":11,"members":{"property":[{"tagname":"property","owner":"Ext.dom.Query","meta":{},"name":"matchers","id":"property-matchers"},{"tagname":"property","owner":"Ext.dom.Query","meta":{},"name":"operators","id":"property-operators"},{"tagname":"property","owner":"Ext.dom.Query","meta":{},"name":"pseudos","id":"property-pseudos"}],"cfg":[],"css_var":[],"method":[{"tagname":"method","owner":"Ext.dom.Query","meta":{},"name":"compile","id":"method-compile"},{"tagname":"method","owner":"Ext.dom.Query","meta":{},"name":"filter","id":"method-filter"},{"tagname":"method","owner":"Ext.dom.Query","meta":{},"name":"is","id":"method-is"},{"tagname":"method","owner":"Ext.dom.Query","meta":{},"name":"jsSelect","id":"method-jsSelect"},{"tagname":"method","owner":"Ext.dom.Query","meta":{},"name":"select","id":"method-select"},{"tagname":"method","owner":"Ext.dom.Query","meta":{},"name":"selectNode","id":"method-selectNode"},{"tagname":"method","owner":"Ext.dom.Query","meta":{},"name":"selectNumber","id":"method-selectNumber"},{"tagname":"method","owner":"Ext.dom.Query","meta":{},"name":"selectValue","id":"method-selectValue"}],"event":[],"css_mixin":[]},"inheritable":null,"private":null,"component":false,"name":"Ext.dom.Query","singleton":true,"override":null,"inheritdoc":null,"id":"class-Ext.dom.Query","mixins":[],"mixedInto":[]});