diff --git a/lib/ender/bridge.js b/lib/ender/bridge.js index 6eda1db..7443e3b 100644 --- a/lib/ender/bridge.js +++ b/lib/ender/bridge.js @@ -62,8 +62,11 @@ } $.ender({ + // boolean, does at least one element in the collection match the given selector is: is , match: is + // find all elements that are children of the elements in this collection matching + // the given selector , find: function (s) { var r = [], i, l, j, k, els for (i = 0, l = this.length; i < l; i++) { @@ -72,8 +75,9 @@ } return $(uniq(r)) } - , and: function (s) { - var plus = $(s) + // add additional elements to this collection matching the given selector + , and: function (s, r) { + var plus = $(s, r) for (var i = this.length, j = 0, l = this.length + plus.length; i < l; i++, j++) { this[i] = plus[j] } @@ -81,4 +85,16 @@ } }, true) + $.ender({ + // allow for NW.Dom.select(selector, root, callback), for speedy code such as + // $.select("div", null, function ( e ) { e.style.backgroundColor = "#ffe"; }); + select: function () { + return $(nw.select.apply(null, arguments)) + } + // like querySelector(), return only the first match, document-order + , first: function (selector, root) { + return $(nw.select(selector, root, function() { return false })) + } + }) + }(document, ender) diff --git a/test/ender/ender.js b/test/ender/ender.js index 0e2c678..07c0a3b 100644 --- a/test/ender/ender.js +++ b/test/ender/ender.js @@ -1778,8 +1778,11 @@ } $.ender({ + // boolean, does at least one element in the collection match the given selector is: is , match: is + // find all elements that are children of the elements in this collection matching + // the given selector , find: function (s) { var r = [], i, l, j, k, els for (i = 0, l = this.length; i < l; i++) { @@ -1788,8 +1791,9 @@ } return $(uniq(r)) } - , and: function (s) { - var plus = $(s) + // add additional elements to this collection matching the given selector + , and: function (s, r) { + var plus = $(s, r) for (var i = this.length, j = 0, l = this.length + plus.length; i < l; i++, j++) { this[i] = plus[j] } @@ -1797,6 +1801,18 @@ } }, true) + $.ender({ + // allow for NW.Dom.select(selector, root, callback), for speedy code such as + // $.select("div", null, function ( e ) { e.style.backgroundColor = "#ffe"; }); + select: function () { + return $(nw.select.apply(null, arguments)) + } + // like querySelector(), return only the first match, document-order + , first: function (selector, root) { + return $(nw.select(selector, root, function() { return false })) + } + }) + }(document, ender)