Commit 7acd7f2f by Иван Кубота

D is now a function that wraps querySelector and returns real Array. also if…

D is now a function that wraps querySelector and returns real Array. also if second argument is passed - it would extend element with generic lib rules
parent 02511af5
......@@ -186,6 +186,17 @@ NS.apply = function(a,b) {
tr: null,
Text: function( val ){ return document.createTextNode( val );}
};
D = NS.D = NS.apply(function( selector, ext ) {
var out = ArraySlice.call(document.querySelectorAll(selector));
if(arguments.length > 1){
for( var i = 0, _i = out.length; i < _i; i++ ){
var element = out[ i ];
D.ext(element, ext);
}
}
return out;
}, D);
'div,template,span,input,label,canvas,span,textarea,table,tr,td,th,tBody,tHead'.split( ',' ).forEach( function( name ){
D[ name ] = function(){
return domEl.apply( null, [ name ].concat(ArraySlice.call(arguments)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment