(function() {
function _$(els) {
this.elements = [];
this.elements = Array.prototype.slice.call(document.querySelectorAll(els));
return this;
}
_$.prototype ={
size: function() {
alert('size:'+this.elements.length);
return this;
}
};
window.$ = function() { return new _$(arguments); }
})();
Использование $('#test').size();