Beispiel #1
0
function contents() {
    var nodes = [];
    _util.each(this, function (element) {
        nodes.push.apply(nodes, _util.toArray(element.childNodes));
    });
    return _index.$(nodes);
}
Beispiel #2
0
function parent(selector) {
    var nodes = [];
    _util.each(this, function (element) {
        if (!selector || selector && _index.matches(element.parentNode, selector)) {
            nodes.push(element.parentNode);
        }
    });
    return _index.$(nodes);
}
Beispiel #3
0
function siblings(selector) {
    var nodes = [];
    _util.each(this, function (element) {
        _util.each(element.parentNode.children, function (sibling) {
            if (sibling !== element && (!selector || selector && _index.matches(sibling, selector))) {
                nodes.push(sibling);
            }
        });
    });
    return _index.$(nodes);
}
Beispiel #4
0
 var _ret = (function () {
     var nodes = [];
     _util.each(_this, function (node) {
         var n = node.closest(selector);
         if (n) {
             nodes.push(n);
         }
     });
     return {
         v: _index.$(_util.uniq(nodes))
     };
 })();
Beispiel #5
0
function children(selector) {
    var nodes = [];
    _util.each(this, function (element) {
        if (element.children) {
            _util.each(element.children, function (child) {
                if (!selector || selector && _index.matches(child, selector)) {
                    nodes.push(child);
                }
            });
        }
    });
    return _index.$(nodes);
}
Beispiel #6
0
 function closest(selector, context) {
     var nodes = [];
     _util.each(this, function (node) {
         while (node && node !== context) {
             if (_index.matches(node, selector)) {
                 nodes.push(node);
                 break;
             }
             node = node.parentElement;
         }
     });
     return _index.$(_util.uniq(nodes));
 }
Beispiel #7
0
function slice(start, end) {
    return _index.$([].slice.apply(this, arguments));
}