UIZE JavaScript Framework

MODULES Uize.Web.xFilters

1. Introduction

The Uize.Web.xFilters module extends the Uize.Web object by adding functionality for filtering & traversing the matched set of DOM elements.

DEVELOPERS: Ben Ilegbodu, original code contributed by Zazzle Inc.

The Uize.Web.xFilters module is an extension module that extends the Uize.Web class. Pages that want to leverage the syntax-friendly nature of Uize.Web may not need to leverage any filtering or traversing functionality. Therefore, the filtering & traversing functionality is not implemented in the Uize.Web class in order to reduce the need for loading the extra code. Instead, in order to include the filtering & traversing functionality, one needs to require the Uize.Web.xFilters extension module.

1.1. Key Features

The Uize.Web.xFilters extension module provides the following features...

1.1.1. Filtering Methods

document...

1.1.2. Tree Traversal Methods

document...

1.2. Examples

There are no dedicated showcase example pages for the Uize.Web.xFilters module.

SEARCH FOR EXAMPLES

Use the link below to search for example pages on the UIZE Web site that reference the Uize.Web.xFilters module...

SEARCH

1.3. Implementation Info

The Uize.Web.xFilters module defines the Uize.Web.xFilters extension module under the Uize.Web namespace.

1.3.1. Features Introduced in This Module

The features listed in this section have been introduced in this module.

STATIC PROPERTIES

Uize.Web.xFilters.moduleName | Uize.Web.xFilters.pathToResources

1.3.2. Features Overridden in This Module

No features have been overridden in this module.

1.3.3. Features Inherited From Other Modules

This module has no inherited features.

1.3.4. Modules Directly Under This Namespace

There are no modules directly under this namespace.

1.3.5. Unit Tests

There is no dedicated unit tests module for the Uize.Web.xFilters module.

2. Instance Methods

2.1. add

Adds nodes to the set of matched nodes.

SYNTAX

myWeb = myWeb.add(selectorSTR);

VARIATION 1

myWeb = myWeb.add(selectorSTR, rootSelector);

VARIATION 2

myWeb = myWeb.add(node);

VARIATION 3

myWeb = myWeb.add(nodesARRAY);

VARIATION 4

myWeb = myWeb.add(myWeb);

VARIATION 5

myWeb = myWeb.add();

NOTES

Returns a reference to the same Uize.Web object
See also Constructor

2.2. ancestors

Retrieves all of the ancestor nodes in the DOM tree (ordered from immediate parent on up) for each DOM node in the matched set of DOM nodes, optionally filtered by the specified selector, returning a new Uize.Web object containing those DOM nodes.

SYNTAX

newWeb = myWeb.ancestors();

VARIATION

newWeb = myWeb.ancestors(selector);

NOTES

Returns a reference to a new Uize.Web object
Any duplicates are removed
See related ancestorsUntil, closest and parent methods

Retrieves all of the ancestor nodes in the DOM tree for each DOM node in the matched set of DOM nodes (ordered from immediate parent on up to but not including the DOM node matching the optional find selector), optionally filtered by the specified filter selector, returning a new Uize.Web object containing those DOM nodes.

SYNTAX

newWeb = myWeb.ancestorsUntil(targetSelector, filterSelector);

VARIATION 1

newWeb = myWeb.ancestorsUntil(targetSelector);

VARIATION 2

newWeb = myWeb.ancestorsUntil();

NOTES

Returns a reference to a new Uize.Web object
Any duplicates are removed
See related ancestors and parent methods

2.3. any

Checks the current matched set of DOM nodes against the specified selector, test function, element or Uize.Web object and returns true if at least one of these DOM nodes matches, and false otherwise.

SYNTAX

anyBOOL = myWeb.any(selectorSTR);

VARIATION 1

anyBOOL = myWeb.any(testFUNC);

VARIATION 2

anyBOOL = myWeb.any(nodeOBJ);

VARIATION 3

anyBOOL = myWeb.any(webOBJ);

2.4. children

Retrieves the children of each DOM node in the matched set of DOM nodes, excluding text and comment nodes, filtered by the optional selector.

SYNTAX

newWeb = myWeb.children();

VARIATION

newWeb = myWeb.children(selector);

NOTES

Returns a reference to a Uize.Web object
See related contents method

2.5. closest

Retrieves the first DOM node in DOM ancestory tree (including the DOM node itself) for each DOM node in the matched set of DOM nodes that matches the specified selector.

SYNTAX

newWeb = myWeb.closest(selector);

NOTES

Returns a reference to a new Uize.Web object
See related ancestors and parent methods

2.6. contained

Checks the current matched set of DOM nodes and returns true if they are contained by the specified DOM node, false otherwise.

SYNTAX

isContainedBOOL = myWeb.contained(nodeBLOB); // one matched node
isContainedARRAY = myWeb.contained(nodeBLOB); // multiple matched nodes

NOTES

If returnAllBOOL is set to true, then the return value for each of the matched nodes is wrapped in an array (even if there's only one matched node). If returnAllBOOL is false or unspecified (undefined), only the value for the first matched node is returned. See Dynamic Methods Return Values for more info.
See also related contains method

2.7. contains

Checks the current matched set of DOM nodes and returns true if they contain the specified DOM node, false otherwise.

SYNTAX

containsBOOL = myWeb.contains(nodeBLOB); // one matched node
containsARRAY = myWeb.contains(nodeBLOB); // multiple matched nodes

NOTES

If returnAllBOOL is set to true, then the return value for each of the matched nodes is wrapped in an array (even if there's only one matched node). If returnAllBOOL is false or unspecified (undefined), only the value for the first matched node is returned. See Dynamic Methods Return Values for more info.
See also related contained method

2.8. contents

Retrieves the children of each DOM node in the matched set of DOM nodes, including text and comment nodes, filtered by the optional selector.

SYNTAX

newWeb = myWeb.contents();

VARIATION

newWeb = myWeb.contents(selector);

NOTES

Returns a reference to a Uize.Web object
See related children method

2.9. filter

Reduce the set of matched DOM nodes to those that match the specified selector, returning a new Uize.Web object containing that DOM node.

SYNTAX

newWeb = myWeb.filter(selectorSTR);

VARIATION 1

newWeb = myWeb.filter(testFUNC);

VARIATION 2

newWeb = myWeb.filter(nodeOBJ);

VARIATION 3

newWeb = myWeb.filter(webOBJ);

NOTES

Returns a reference to the a new Uize.Web object
See companion not method

2.10. find

Retrieves all the descendants of each of the set of matched DOM nodes, filtered by the specified selector, node generator function, element or Uize.Web object.

SYNTAX

newWeb = myWeb.find(selectorSTR);

VARIATION 1

newWeb = myWeb.find(testFUNC);

VARIATION 2

newWeb = myWeb.find(nodeOBJ);

VARIATION 3

newWeb = myWeb.find(webOBJ);

VARIATION 4

newWeb = myWeb.find(propertiesOBJ);

VARIATION 5

newWeb = myWeb.find();

NOTES

Returns a reference to the a new Uize.Web object
See related ancestors and has methods

2.11. first

Reduces the set of matched DOM nodes to the first in the set, returning a new Uize.Web object containing that DOM node.

SYNTAX

newWeb = myWeb.first();

VARIATION 1

newWeb = myWeb.first(selectorSTR);

VARIATION 2

newWeb = myWeb.first(testFUNC);

VARIATION 3

newWeb = myWeb.first(nodeOBJ);

VARIATION 4

newWeb = myWeb.first(webOBJ);

NOTES

Returns a reference to the a new Uize.Web object
See companion last method
See related single and filter methods

2.12. has

Reduces the set of matched DOM nodes to those that have a descendant that matches the specified selector, test function, element or Uize.Web object.

SYNTAX

newWeb = myWeb.has(selectorSTR);

VARIATION 1

newWeb = myWeb.has(testFUNC);

VARIATION 2

newWeb = myWeb.has(nodeOBJ);

VARIATION 3

newWeb = myWeb.has(webOBJ);

NOTES

Returns a reference to the a new Uize.Web object
See related find method

2.13. index

Returns an integer indicating the position of the specified selector, node generator function, element or Uize.Web object within the set of matched DOM nodes.

SYNTAX

indexINT = myWeb.index(selectorSTR);

VARIATION 1

indexINT = myWeb.index(nodeFUNC);

VARIATION 2

indexINT = myWeb.index(nodeOBJ);

VARIATION 3

indexINT = myWeb.index(webOBJ);

NOTES

Returns -1 if a match is not found

2.14. last

Reduce the set of matched DOM nodes to the last in the set, returning a new Uize.Web object containing that DOM node.

SYNTAX

newWeb = myWeb.last();

VARIATION 1

newWeb = myWeb.last(selectorSTR);

VARIATION 2

newWeb = myWeb.last(testFUNC);

VARIATION 3

newWeb = myWeb.last(nodeOBJ);

VARIATION 4

newWeb = myWeb.last(webOBJ);

NOTES

Returns a reference to the a new Uize.Web object
See companion first method
See related single and filter methods

2.15. map

Passes each DOM node in the matched set of DOM nodes through the specified mapping function, producting a new Uize.Web object containing the return values.

SYNTAX

newWeb = myWeb.map(mapperFUNC);

NOTES

Returns a reference to a Uize.Web object

2.16. next

Retrieves the immediate sibling following each DOM node in the matched set of DOM nodes, excluding text and comment nodes, filtered by the optional selector.

SYNTAX

newWeb = myWeb.next();

VARIATION

newWeb = myWeb.next(selector);

NOTES

Returns a reference to a Uize.Web object
See related previous, nextAll and nextUntil methods

2.17. nextAll

Retrieves the following siblings of each DOM node in the matched set of DOM nodes, excluding text and comment nodes, filtered by the optional selector.

SYNTAX

newWeb = myWeb.nextAll();

VARIATION

newWeb = myWeb.nextAll(selector);

NOTES

Returns a reference to a Uize.Web object
See related next and nextUntil methods

2.18. nextUntil

Retrieves the following siblings of each DOM node in the matched set of DOM nodes, excluding text and comment nodes, up to but not including the DOM node matched by the target selector and filtered by the optional selector.

SYNTAX

newWeb = myWeb.nextUntil(target);

VARIATION

newWeb = myWeb.nextUntil(target, filter);

NOTES

Returns a reference to a Uize.Web object
See related next and nextAll methods

2.19. not

Reduce the set of matched DOM nodes to those that do not match the specified selector, returning a new Uize.Web object containing that DOM node.

SYNTAX

newWeb = myWeb.not(selectorSTR);

VARIATION 1

newWeb = myWeb.not(testFUNC);

VARIATION 2

newWeb = myWeb.not(nodeOBJ);

VARIATION 3

newWeb = myWeb.not(webOBJ);

NOTES

Returns a reference to the a new Uize.Web object
See companion filter method

2.20. parent

Retrieves the parent node for each DOM node in the matched set of DOM nodes, optionally filtered by the specified selector, returning a new Uize.Web object containing those DOM nodes.

SYNTAX

newWeb = myWeb.parent();

VARIATION 1

newWeb = myWeb.parent(selector);

NOTES

Returns a reference to a new Uize.Web object
Any duplicates are removed
See related ancestors, ancestorsUntil and closest methods

2.21. previous

Retrieves the immediate sibling preceeding each DOM node in the matched set of DOM nodes, excluding text and comment nodes, filtered by the optional selector.

SYNTAX

newWeb = myWeb.previous();

VARIATION

newWeb = myWeb.previous(selector);

NOTES

Returns a reference to a Uize.Web object
See related next, previousAll and previousUntil methods

2.22. previousAll

Retrieves the preceeding siblings of each DOM node in the matched set of DOM nodes, excluding text and comment nodes, filtered by the optional selector.

SYNTAX

newWeb = myWeb.previousAll();

VARIATION

newWeb = myWeb.previousAll(selector);

NOTES

Returns a reference to a Uize.Web object
See related previous and previousUntil methods

2.23. previousUntil

Retrieves the preceeding siblings of each DOM node in the matched set of DOM nodes, excluding text and comment nodes, up to but not including the DOM node matched by the target selector and filtered by the optional selector.

SYNTAX

newWeb = myWeb.previousUntil(target);

VARIATION

newWeb = myWeb.previousUntil(target, filter);

NOTES

Returns a reference to a Uize.Web object
See related previous and previousAll methods

2.24. siblingIndex

Retrieves an integer indicating the position of the first DOM node within the matched set of DOM nodes relative to its sibling elements in the DOM.

SYNTAX

indexINT = myWeb.siblingIndex(); // one matched node

VARIATION

indexARRAY = myWeb.siblingIndex(returnAllBOOL); // multiple matched nodes

NOTES

If returnAllBOOL is set to true, then the return value for each of the matched nodes is wrapped in an array (even if there's only one matched node). If returnAllBOOL is false or unspecified (undefined), only the value for the first matched node is returned. See Dynamic Methods Return Values for more info.

2.25. siblings

Retrieves the siblings of each DOM node in the matched set of DOM nodes, excluding text and comment nodes, filtered by the optional selector.

SYNTAX

newWeb = myWeb.siblings();

VARIATION

newWeb = myWeb.siblings(selector);

NOTES

Returns a reference to a Uize.Web object
See related nextAll and previousAll methods

2.26. single

Reduce the set of matched DOM nodes to the one at the specified index, returning a new Uize.Web object containing that DOM node.

SYNTAX

newWeb = myWeb.single(indexINT);

NOTES

Returns a reference to the a new Uize.Web object

2.27. slice

Reduce the set of matched DOM nodes to the one at the specified range of indices, returning a new Uize.Web object containing that DOM node.

SYNTAX

newWeb = myWeb.slice(startINT, endINT);

VARIATION

newWeb = myWeb.slice(startINT);

NOTES

Returns a reference to the a new Uize.Web object

3. Static Properties

3.1. Uize.Web.xFilters.moduleName

IMPLEMENTATION INFO

this feature was introduced in this module

3.2. Uize.Web.xFilters.pathToResources

IMPLEMENTATION INFO

this feature was introduced in this module