Top

mixin Node-Traversal

Extends Node with tree traversal utility methods.

Details:
See:

Methods

getAncestors(selector) → {Array.<smx.Node>}

Gets a list of all ancestor nodes matching the given selector, ordered from outer to inner.

Parameters
  • selector {String}
Returns

isAncestorOf(node) → {Boolean}

Checks if node is an ancestor of another.

Parameters
Returns
  • {Boolean}

isMatch(selector) → {Boolean}

Checks if node matches the given selector.

Parameters
  • selector {String} :

    css selector to match

Returns
  • {Boolean}

find(selector) → {Array.<Node>}

Finds all descendant nodes matching the given selector.

Parameters
  • selector {String} :

    search selector

Returns
  • {Array.<Node>}

findOne(selector) → {smx.Node}

This method is like find but returns only the first result.

Parameters
  • selector {String} :

    search selector

Returns

getChildren([selector]) → {Array.<Node>}

Gets the children nodes matching the given selector.

Parameters
  • [selector] {String}
Returns
  • {Array.<Node>}

getFirst([selector]) → {smx.Node}

Gets the first child node matching the given selector.

Parameters
  • [selector] {String}
Returns

getLast([selector]) → {smx.Node}

Gets the last child node matching the given selector.

Parameters
  • [selector] {String}
Returns

getChildAt(index) → {smx.Node}

Gets child node at given index

Parameters
  • index {Integer} :

    index position

Returns

isDescendantOf(node) → {Boolean}

Checks if a node is child of another

Parameters
Returns
  • {Boolean}

getNext([selector]) → {smx.Node}

Gets the next sibling node matching the given selector.

Parameters
  • [selector] {String} :

    filter selector

Returns

getAllNext([selector]) → {Array.<smx.Node>}

Gets all next sibling nodes matching the given selector.

Parameters
  • [selector] {String} :

    filter selector

Returns

getPrevious([selector]) → {smx.Node}

Gets the previous sibling node matching the given selector.

Parameters
  • [selector] {String} :

    filter selector

Returns

getAllPrevious([selector]) → {Array.<smx.Node>}

Gets all previous sibling nodes matching the given selector.

Parameters
  • [selector] {String} :

    filter selector

Returns