Skip to content

Commit

Permalink
refactor comment bug workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Mar 9, 2012
1 parent df38fcc commit 6bcfa3f
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions lib/zest.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,20 @@ var nth = function(param, test, last) {
*/

var selectors = {
'*': function() {
return true;
},
'*': (function() {
if (function() {
var el = document.createElement('div');
el.appendChild(document.createComment(''));
return !!el.getElementsByTagName('*')[0];
}()) {
return function(el) {
if (el.nodeType === 1) return true;
};
}
return function() {
return true;
};
})(),
'type': function(type) {
type = type.toLowerCase();
return function(el) {
Expand Down Expand Up @@ -804,7 +815,7 @@ var find = function(sel, node) {
};

/**
* Compatibility
* Native
*/

var select = (function() {
Expand Down Expand Up @@ -851,16 +862,6 @@ var select = (function() {
};
})();

if (function() {
var el = document.createElement('div');
el.appendChild(document.createComment(''));
return !!el.getElementsByTagName('*')[0];
}()) {
selectors['*'] = function(el) {
if (el.nodeType === 1) return true;
};
}

/**
* Zest
*/
Expand Down

0 comments on commit 6bcfa3f

Please sign in to comment.