Removed selector function from global scope, .(selector).el does the same thing

This commit is contained in:
Timothy Warren 2011-07-08 13:21:21 -04:00
parent a3f270ba95
commit 9014a081ab
1 changed files with 38 additions and 35 deletions

73
kis.js
View File

@ -18,41 +18,8 @@
return; return;
} }
var $_, $, sel; var $_, $;
/**
* $_
*
* Constructor function
*/
$_ = function(sel)
{
//Get the DOM objects from the selector
sel = $(sel);
//Have window be default selector, just in case
if(typeof sel === "undefined")
{
sel = (typeof $_.el !== "undefined")
? $_.el
: window;
}
$_.el = sel;
return $_;
};
$_ = window.$_ = window.$_ || $_;
//console.log polyfill
if(typeof window.console === "undefined")
{
window.console = {
log:function(){}
};
}
/** /**
* $ * $
* *
@ -81,7 +48,41 @@
return (x.length === 1) ? x[0] : x; return (x.length === 1) ? x[0] : x;
}; };
window.$ = $; /**
* $_
*
* Constructor function
*/
$_ = function(sel)
{
//Get the DOM objects from the selector
sel = $(sel);
//Have window be default selector, just in case
if(typeof sel === "undefined")
{
sel = (typeof $_.el !== "undefined")
? $_.el
: window;
}
$_.el = sel;
return $_;
};
//Set global variables
$_ = window.$_ = window.$_ || $_;
//console.log polyfill
if(typeof window.console === "undefined")
{
window.console = {
log:function(){}
};
}
// --------------------------------------------------------------------------
$_.each = function (callback) $_.each = function (callback)
{ {
@ -672,6 +673,8 @@
//No matches? Well, lets log it for now //No matches? Well, lets log it for now
console.log("Property " + prop + " nor an equivalent seems to exist"); console.log("Property " + prop + " nor an equivalent seems to exist");
} }
// --------------------------------------------------------------------------
d = { d = {
addClass: function (c) addClass: function (c)