Permalink
Browse files

duck type on windows and documents

  • Loading branch information...
1 parent cdeb659 commit 0d7113e2943068f881f23de7fb5946d1178e80f8 @ded committed May 15, 2012
Showing with 8 additions and 6 deletions.
  1. +1 −1 mobile/package.json
  2. +3 −2 mobile/qwery-mobile.js
  3. +1 −1 mobile/qwery-mobile.min.js
  4. +3 −2 mobile/src/mobile.js
View
@@ -1,7 +1,7 @@
{
"name": "qwery-mobile",
"description": "Mobile query selector engine",
- "version": "1.0.7",
+ "version": "1.0.8",
"homepage": "https://github.com/ded/qwery",
"authors": ["Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)", "Jacob Thornton"],
"repository": {
View
@@ -54,8 +54,9 @@
if (doc.getElementsByClassName && selector == 'string' && (m = selector.match(classOnly))) {
return toArray((root).getElementsByClassName(m[1]))
}
- if (selector == win || selector == doc) {
- return !_root ? [selector] : [null]
+ // using duck typing for 'a' window or 'a' document (not 'the' window || document)
+ if (selector && (selector.document || (selector.nodeType && selector.nodeType == 9))) {
+ return !_root ? [selector] : []
}
if (isNode(selector)) {
return !root || (isAncestor(selector, root)) ? [selector] : []

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

Oops, something went wrong.
View
@@ -47,8 +47,9 @@
if (doc.getElementsByClassName && selector == 'string' && (m = selector.match(classOnly))) {
return toArray((root).getElementsByClassName(m[1]))
}
- if (selector == win || selector == doc) {
- return !_root ? [selector] : [null]
+ // using duck typing for 'a' window or 'a' document (not 'the' window || document)
+ if (selector && (selector.document || (selector.nodeType && selector.nodeType == 9))) {
+ return !_root ? [selector] : []
}
if (isNode(selector)) {
return !root || (isAncestor(selector, root)) ? [selector] : []

0 comments on commit 0d7113e

Please sign in to comment.