Comparing version 0.1.11 to 0.1.13
76
ender.js
// inspired from https://github.com/ded/qwery/blob/master/src/ender.js | ||
(function(){ | ||
var nut=require('nut'); | ||
$._select=function(selectors,contexts){ | ||
// Nodes | ||
if(typeof selectors!='string'){ | ||
return selectors; | ||
$._select=function(selectors,contexts){ | ||
// Nodes | ||
if(typeof selectors!='string'){ | ||
return selectors; | ||
} | ||
// New element | ||
else if(selectors.match(/^\s*</)){ | ||
var tag=selectors.match(/^\s*<\s*([a-z]+)/i)[1], | ||
table='table', | ||
nodeMap={ | ||
thead: table, | ||
tbody: table, | ||
tfoot: table, | ||
tr: 'tbody', | ||
th: 'tr', | ||
td: 'tr', | ||
fieldset: 'form', | ||
option: 'select' | ||
}, | ||
root=document.createElement(nodeMap[tag] || 'div'), | ||
element, | ||
elements=[], | ||
i=-1; | ||
root.innerHTML=selectors; | ||
element=root.firstChild; | ||
do{ | ||
element.nodeType==1 && elements.push(element); | ||
} | ||
// New element | ||
else if(selectors.match(/^\s*</)){ | ||
var tag=selectors.match(/^\s*<\s*([a-z]+)/i)[1], | ||
table='table', | ||
nodeMap={ | ||
thead: table, | ||
tbody: table, | ||
tfoot: table, | ||
tr: 'tbody', | ||
th: 'tr', | ||
td: 'tr', | ||
fieldset: 'form', | ||
option: 'select' | ||
}, | ||
root=document.createElement(nodeMap[tag] || 'div'), | ||
element, | ||
elements=[], | ||
i=-1; | ||
root.innerHTML=selectors; | ||
element=root.firstChild; | ||
do{ | ||
element.nodeType==1 && elements.push(element); | ||
} | ||
while(element=element.nextSibling) | ||
return elements; | ||
} | ||
// Selectors | ||
else{ | ||
return nut(selectors,contexts); | ||
} | ||
}; | ||
}()); | ||
while(element=element.nextSibling) | ||
return elements; | ||
} | ||
// Selectors | ||
else{ | ||
return require('nut')(selectors,contexts); | ||
} | ||
}; |
/* | ||
nut, the concise CSS selector engine | ||
Version : 0.1.11 | ||
Version : 0.1.13 | ||
Author : Aurélien Delogu (dev@dreamysource.fr) | ||
@@ -6,0 +6,0 @@ Homepage : https://github.com/pyrsmk/nut |
{ | ||
"name" : "nut", | ||
"description" : "The concise CSS selector engine", | ||
"version" : "0.1.11", | ||
"version" : "0.1.13", | ||
"author" : "Aurélien Delogu <pyrsmk@dreamysource.fr> (http://dreamysource.fr)", | ||
@@ -6,0 +6,0 @@ "repository" : { |
7756
229