Permalink
Browse files

fix for ender-js@0.4.* compat, published 0.0.7

  • Loading branch information...
rvagg committed May 10, 2012
1 parent cf6b683 commit bd33785d3333bee72ee141bebc5f101d0be94de2
Showing with 26 additions and 18 deletions.
  1. +1 −1 build.js
  2. +1 −1 package.json
  3. +6 −2 src/traversty.js
  4. +3 −2 test/core-test.js
  5. +2 −3 test/engines-test.js
  6. +6 −6 test/setup.js
  7. +6 −2 traversty.js
  8. +1 −1 traversty.min.js
View
@@ -16,14 +16,14 @@ var jshintOptions = {
, 'sub': true
, 'white': false
, 'indent': 2
- , 'whitespace': true
, 'asi': true
, 'laxbreak': true
, 'eqeqeq': true
, 'eqnull': true
, 'browser': true
, 'node': true
, 'laxcomma': true
+ , 'strict': false
}
require('smoosh')
.config({
View
@@ -1,7 +1,7 @@
{
"name": "traversty"
, "description": "Library agnostic utility for traversing the DOM"
- , "version": "0.0.6"
+ , "version": "0.0.7"
, "homepage": "https://github.com/rvagg/traversty"
, "author": "Rod Vagg <rod@vagg.org> @rvagg"
, "keywords": ["ender", "dom", "nodes"]
View
@@ -92,8 +92,12 @@
}
, collect = function (els, fn) {
- var ret = [], i = 0, l = els.length
- while (i < l) ret = ret.concat(fn(els[i++]))
+ var ret = [], res, i = 0, j, l = els.length, l2
+ while (i < l) {
+ j = 0
+ l2 = (res = fn(els[i++])).length
+ while (j < l2) ret.push(res[j++])
+ }
return ret
}
View
@@ -28,7 +28,7 @@ buster.testCase('traversty', {
}
, 'traversty() can be passed selector strings': function () {
- var el, t
+ var t
if (__matchesSelector) { // defined in setup.js
// T("#fixtures") has #fixtures element (only)
@@ -39,7 +39,8 @@ buster.testCase('traversty', {
assert.equals((t = T('#fixtures,div#flat')).length, 2)
assert.same(t[0], Q('#fixtures')[0])
assert.same(t[1], Q('div#flat')[0])
- }
+ } else
+ assert(true) // needed for buster
}
}
)
View
@@ -36,11 +36,10 @@ var own = Object.prototype.hasOwnProperty
// native must be first so we start off without T.setSelectorEngine() being called
// we also don't want to run native tests in older browsers that don't support it
-if (!!__matchesSelector)
- engineTest(null, 'Native')
+if (__matchesSelector) engineTest(null, 'Native')
engineTest(Q, 'Qwery')
engineTest(Sizzle, 'Sizzle')
engineTest(NW.Dom, 'NW')
// Sel must be last because it requires es5-basic which extends natives and we don't
// want that impacting any other tests in unexpected ways
-engineTest(sel, 'Sel', function() { loadES5Basic() })
+engineTest(sel, 'Sel', function() { loadES5Basic() })
View
@@ -1,12 +1,12 @@
/*global qwery:true, traversty:true, assert: true, buster:true*/
var Q = qwery.noConflict()
-var T = traversty.noConflict()
-var __matchesSelector = (function (el, pfx, name, i, ms) {
- while (i < pfx.length)
- if (el[ms = pfx[i++] + name]) return ms
- if (el[name = 'm' + name.substring(1)]) return name
-}(document.documentElement, [ 'ms', 'webkit', 'moz', 'o' ], 'MatchesSelector', 0))
+ , T = traversty.noConflict()
+ , __matchesSelector = (function (el, pfx, name, i, ms) {
+ while (i < pfx.length)
+ if (el[ms = pfx[i++] + name]) return ms
+ return false
+ }(document.documentElement, [ 'msM', 'webkitM', 'mozM', 'oM', 'm' ], 'atchesSelector', 0))
assert.equals.message += ": ${2}";
assert.same.message += ": ${2}";
View
@@ -98,8 +98,12 @@
}
, collect = function (els, fn) {
- var ret = [], i = 0, l = els.length
- while (i < l) ret = ret.concat(fn(els[i++]))
+ var ret = [], res, i = 0, j, l = els.length, l2
+ while (i < l) {
+ j = 0
+ l2 = (res = fn(els[i++])).length
+ while (j < l2) ret.push(res[j++])
+ }
return ret
}
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit bd33785

Please sign in to comment.