打印版式

Class Ext.DomQuery

Package:Ext
Class:DomQuery
Extends:Object
Defined In:DomQuery.js
* Provides high performance selector/xpath processing by compiling queries into reusable functions. New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in).

This class is a singleton and cannot be created directly.

属性   -  方法   -  事件

公共属性

属性 定义对象
  matchers : Object DomQuery
Collection of matching regular expressions and code snippets.
  operators : Object DomQuery
Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *= and %=. New operators can be...
  pseudos : Object DomQuery
Collection of "pseudo class" processors. Each processor is passed the current nodeset (array) and the argument (if an...

公共方法

方法 定义对象
  compile(String selector, [String type]) : Function DomQuery
Compiles a selector/xpath query into a reusable function. The returned function takes one parameter "root" (可选)...
  filter(Array el, String selector, Boolean nonMatches) : Array DomQuery
Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
  is(String/HTMLElement/Array el, String selector) : Boolean DomQuery
Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
  select(String selector, [Node root]) : Array DomQuery
Selects a group of elements.
  selectNode(String selector, [Node root]) : Element DomQuery
Selects a single element.
  selectNumber(String selector, [Node root], Number defaultValue) : Number DomQuery
Selects the value of a node, parsing integers and floats.
  selectValue(String selector, [Node root], String defaultValue) : void DomQuery
Selects the value of a node, optionally replacing null with the defaultValue.

公共事件

此类没有公共事件。

属性详情

matchers

public Object matchers
Collection of matching regular expressions and code snippets.
This property is defined by DomQuery.

operators

public Object operators
Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *= and %=. New operators can be added as long as the match the format c= where c is any character other than space, > <.
This property is defined by DomQuery.

pseudos

public Object pseudos
Collection of "pseudo class" processors. Each processor is passed the current nodeset (array) and the argument (if any) supplied in the selector.
This property is defined by DomQuery.

方法详情

compile

public function compile(String selector, [String type])
Compiles a selector/xpath query into a reusable function. The returned function takes one parameter "root" (可选), which is the context node from where the query should start.
参数:
  • selector : String
    The selector/xpath query
  • type : String
    (可选) Either "select" (the default) or "simple" for a simple selector match
返回:
  • Function
This method is defined by DomQuery.

filter

public function filter(Array el, String selector, Boolean nonMatches)
Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
参数:
  • el : Array
    An array of elements to filter
  • selector : String
    The simple selector to test
  • nonMatches : Boolean
    If true, it returns the elements that DON'T match the selector instead of the ones that match
返回:
  • Array
This method is defined by DomQuery.

is

public function is(String/HTMLElement/Array el, String selector)
Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
参数:
  • el : String/HTMLElement/Array
    An element id, element or array of elements
  • selector : String
    The simple selector to test
返回:
  • Boolean
This method is defined by DomQuery.

select

public function select(String selector, [Node root])
Selects a group of elements.
参数:
  • selector : String
    The selector/xpath query
  • root : Node
    (可选) The start of the query (defaults to document).
返回:
  • Array
This method is defined by DomQuery.

selectNode

public function selectNode(String selector, [Node root])
Selects a single element.
参数:
  • selector : String
    The selector/xpath query
  • root : Node
    (可选) The start of the query (defaults to document).
返回:
  • Element
This method is defined by DomQuery.

selectNumber

public function selectNumber(String selector, [Node root], Number defaultValue)
Selects the value of a node, parsing integers and floats.
参数:
  • selector : String
    The selector/xpath query
  • root : Node
    (可选) The start of the query (defaults to document).
  • defaultValue : Number
返回:
  • Number
This method is defined by DomQuery.

selectValue

public function selectValue(String selector, [Node root], String defaultValue)
Selects the value of a node, optionally replacing null with the defaultValue.
参数:
  • selector : String
    The selector/xpath query
  • root : Node
    (可选) The start of the query (defaults to document).
  • defaultValue : String
返回:
  • void
This method is defined by DomQuery.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.