diff --git a/docs/symbols/src/kis-js_src_modules_DOM.js.html b/docs/symbols/src/kis-js_src_modules_DOM.js.html index 4e0d4ee..6c5d06f 100755 --- a/docs/symbols/src/kis-js_src_modules_DOM.js.html +++ b/docs/symbols/src/kis-js_src_modules_DOM.js.html @@ -5,7 +5,7 @@ .STRN {color: #393;} .REGX {color: #339;} .line {border-right: 1px dotted #666; color: #666; font-style: normal;} -
  1 //This is used so IE 8 can use the classList api
+	
  1 //This is used so IE can use the classList api
   2 /*
   3  * classList.js: Cross-browser full element.classList implementation.
   4  * 2011-06-15
@@ -213,9 +213,9 @@
 206 		//Well, I guess that attribute doesn't exist
 207 		if (typeof oldVal === "undefined" && (typeof value === "undefined" || value === null))
 208 		{
-209 			console.log(value);
-210 			console.log(sel);
-211 			console.log("Element does not have the selected attribute");
+209 			/*console.log(value);
+210 			console.log(sel);
+211 			console.log("Element does not have the selected attribute");*/
 212 			return null;
 213 		}
 214 
@@ -301,247 +301,242 @@
 294 			sel.style[equi[prop]] = val;
 295 			return null;
 296 		}
-297 
-298 		//No matches? Well, lets log it for now
-299 		console.log("Property " + prop + " nor an equivalent seems to exist");
-300 	}
-301 
-302 	// --------------------------------------------------------------------------
-303 
-304 	/**
-305 	 * DOM
-306 	 *
-307 	 * Dom manipulation module
-308 	 * @namespace
-309 	 * @memberOf $_
-310 	 * @name dom
-311 	 */
-312 	d = {
-313 		/**
-314 		 * Adds a class to the element(s) specified by the current
-315 		 * selector
-316 		 *
-317 		 * @name addClass
-318 		 * @memberOf $_.dom
-319 		 * @function
-320 		 * @param string class
-321 		 */
-322 		addClass: function (c)
-323 		{
-324 			$_.each(function (e){
-325 				e.classList.add(c);
-326 			});
-327 		},
-328 		/**
-329 		 * Removes a class from the element(s) specified by the current
-330 		 * selector
-331 		 *
-332 		 * @name removeClass
-333 		 * @memberOf $_.dom
-334 		 * @function
-335 		 * @param string class
-336 		 */
-337 		removeClass: function (c)
-338 		{
-339 			$_.each(function (e){
-340 				e.classList.remove(c);
-341 			});
-342 		},
-343 		/**
-344 		 * Hides the element(s) specified by the current selector
-345 		 *
-346 		 * @name hide
-347 		 * @memberOf $_.dom
-348 		 * @function
-349 		 */
-350 		hide: function ()
-351 		{
-352 			this.css('display', 'none');
-353 		},
-354 		/**
-355 		 * Shows the element(s) specified by the current selector.
-356 		 * if type is specified, the element will have it's style
-357 		 * property set to "display:[your type]". If type is not
-358 		 * specified, the element is set to "display:block".
-359 		 *
-360 		 * @name  show
-361 		 * @memberOf $_.dom
-362 		 * @function
-363 		 * @param [string] type
-364 		 */
-365 		show: function (type)
-366 		{
-367 			if (typeof type === "undefined")
-368 			{
-369 				type = "block";
-370 			}
-371 
-372 			this.css("display", type);
-373 		},
-374 		/**
-375 		 * Sets attributes on element(s) specified by the current
-376 		 * selector, or, if name is not specified, returns the
-377 		 * value of the attribute of the element specified by the
-378 		 * current selector.
-379 		 *
-380 		 * @name attr
-381 		 * @memberOf $_.dom
-382 		 * @function
-383 		 * @param string name
-384 		 * @param [string] value
-385 		 * @return string
-386 		 * @type string
-387 		 */
-388 		attr: function (name, value)
-389 		{
-390 			var sel = this.el;
-391 
-392 			//Make sure you don't try to get a bunch of elements
-393 			if (sel.length > 1 && typeof value === "undefined")
-394 			{
-395 				console.log(sel);
-396 				console.log("Must be a singular element");
-397 				return;
-398 			}
-399 			else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though
-400 			{
-401 				$_.each(function (e){
-402 					return _attr(e, name, value);
-403 				});
-404 			}
-405 			else //Normal behavior
-406 			{
-407 				return _attr(sel, name, value);
-408 			}
-409 		},
-410 		/**
-411 		 * Sets or retrieves the text content of the element
-412 		 * specified by the current selector. If a value is
-413 		 * passed, it will set that value on the current element,
-414 		 * otherwise it will return the value of the current element
-415 		 *
-416 		 * @name text
-417 		 * @memberOf $_.dom
-418 		 * @function
-419 		 * @param [string] value
-420 		 * @return string
-421 		 * @type string
-422 		 */
-423 		text: function (value)
-424 		{
-425 			var oldValue, set, type, sel;
-426 
-427 			sel = this.el;
-428 
-429 			set = (typeof value !== "undefined") ? true : false;
-430 
-431 			type = (typeof sel.textContent !== "undefined")
-432 				? "textContent"
-433 				: (typeof sel.innerText !== "undefined")
-434 					? "innerText"
-435 					: "innerHTML";
-436 
-437 			oldValue = sel[type];
-438 
-439 			if(set)
+297 	}
+298 
+299 	// --------------------------------------------------------------------------
+300 
+301 	/**
+302 	 * DOM
+303 	 *
+304 	 * Dom manipulation module
+305 	 * @namespace
+306 	 * @memberOf $_
+307 	 * @name dom
+308 	 */
+309 	d = {
+310 		/**
+311 		 * Adds a class to the element(s) specified by the current
+312 		 * selector
+313 		 *
+314 		 * @name addClass
+315 		 * @memberOf $_.dom
+316 		 * @function
+317 		 * @param string class
+318 		 */
+319 		addClass: function (c)
+320 		{
+321 			$_.each(function (e){
+322 				e.classList.add(c);
+323 			});
+324 		},
+325 		/**
+326 		 * Removes a class from the element(s) specified by the current
+327 		 * selector
+328 		 *
+329 		 * @name removeClass
+330 		 * @memberOf $_.dom
+331 		 * @function
+332 		 * @param string class
+333 		 */
+334 		removeClass: function (c)
+335 		{
+336 			$_.each(function (e){
+337 				e.classList.remove(c);
+338 			});
+339 		},
+340 		/**
+341 		 * Hides the element(s) specified by the current selector
+342 		 *
+343 		 * @name hide
+344 		 * @memberOf $_.dom
+345 		 * @function
+346 		 */
+347 		hide: function ()
+348 		{
+349 			this.css('display', 'none');
+350 		},
+351 		/**
+352 		 * Shows the element(s) specified by the current selector.
+353 		 * if type is specified, the element will have it's style
+354 		 * property set to "display:[your type]". If type is not
+355 		 * specified, the element is set to "display:block".
+356 		 *
+357 		 * @name  show
+358 		 * @memberOf $_.dom
+359 		 * @function
+360 		 * @param [string] type
+361 		 */
+362 		show: function (type)
+363 		{
+364 			if (typeof type === "undefined")
+365 			{
+366 				type = "block";
+367 			}
+368 
+369 			this.css("display", type);
+370 		},
+371 		/**
+372 		 * Sets attributes on element(s) specified by the current
+373 		 * selector, or, if name is not specified, returns the
+374 		 * value of the attribute of the element specified by the
+375 		 * current selector.
+376 		 *
+377 		 * @name attr
+378 		 * @memberOf $_.dom
+379 		 * @function
+380 		 * @param string name
+381 		 * @param [string] value
+382 		 * @return string
+383 		 * @type string
+384 		 */
+385 		attr: function (name, value)
+386 		{
+387 			var sel = this.el;
+388 
+389 			//Make sure you don't try to get a bunch of elements
+390 			if (sel.length > 1 && typeof value === "undefined")
+391 			{
+392 				return null;
+393 			}
+394 			else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though
+395 			{
+396 				$_.each(function (e){
+397 					return _attr(e, name, value);
+398 				});
+399 			}
+400 			else //Normal behavior
+401 			{
+402 				return _attr(sel, name, value);
+403 			}
+404 		},
+405 		/**
+406 		 * Sets or retrieves the text content of the element
+407 		 * specified by the current selector. If a value is
+408 		 * passed, it will set that value on the current element,
+409 		 * otherwise it will return the value of the current element
+410 		 *
+411 		 * @name text
+412 		 * @memberOf $_.dom
+413 		 * @function
+414 		 * @param [string] value
+415 		 * @return string
+416 		 * @type string
+417 		 */
+418 		text: function (value)
+419 		{
+420 			var oldValue, set, type, sel;
+421 
+422 			sel = this.el;
+423 
+424 			set = (typeof value !== "undefined") ? true : false;
+425 
+426 			type = (typeof sel.textContent !== "undefined")
+427 				? "textContent"
+428 				: (typeof sel.innerText !== "undefined")
+429 					? "innerText"
+430 					: "innerHTML";
+431 
+432 			oldValue = sel[type];
+433 
+434 			if(set)
+435 			{
+436 				sel[type] = value;
+437 				return value;
+438 			}
+439 			else
 440 			{
-441 				sel[type] = value;
-442 				return value;
-443 			}
-444 			else
-445 			{
-446 				return oldValue;
-447 			}
-448 		},
-449 		/**
-450 		 * Sets or retrieves a css property of the element
-451 		 * specified by the current selector. If a value is
-452 		 * passed, it will set that value on the current element,
-453 		 * otherwise it will return the value of the css property
-454 		 * on the current element
-455 		 *
-456 		 * @name css
-457 		 * @memberOf $_.dom
-458 		 * @function
-459 		 * @param string property
-460 		 * @param [string] value
-461 		 * @return string
-462 		 * @type string
-463 		 */
-464 		css: function (prop, val)
-465 		{
-466 			//Return the current value if a value is not set
-467 			if(typeof val === "undefined")
-468 			{
-469 				return _css(this.el, prop);
-470 			}
-471 
-472 			$_.each(function (e){
-473 				_css(e, prop, val);
-474 			});
-475 		},
-476 		/**
-477 		 * Adds to the innerHTML of the current element, after the last child.
-478 		 *
-479 		 * @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
-480 		 * @name append
-481 		 * @memberOf $_.dom
-482 		 * @function
-483 		 * @param string htm
-484 		 */
-485 		append: function(htm)
-486 		{
-487 			if(typeof document.insertAdjacentHTML !== "undefined")
-488 			{
-489 				this.el.insertAdjacentHTML('beforeend', htm);
-490 			}
-491 			else
-492 			{
-493 				this.el.innerHTML += htm;
-494 			}
-495 		},
-496 		/**
-497 		 * Adds to the innerHTML of the selected element, before the current children
-498 		 *
-499 		 * @name prepend
-500 		 * @memberOf $_.dom
-501 		 * @function
-502 		 * @param string htm
-503 		 */
-504 		 prepend: function(htm)
-505 		 {
-506 		 	if(typeof document.insertAdjacentHTML !== "undefined")
-507 		 	{
-508 		 		this.el.insertAdjacentHTML('afterbegin', htm);
-509 		 	}
-510 		 	else
-511 		 	{
-512 		 		this.el.innerHTML = htm + this.el.innerHTML;
-513 		 	}
-514 		 },
-515 		/**
-516 		 * Sets or gets the innerHTML propery of the element(s) passed
-517 		 *
-518 		 * @name html
-519 		 * @memberOf $_.dom
-520 		 * @function
-521 		 * @param [string] htm
-522 		 * @return string
-523 		 * @type string
-524 		 */
-525 		html: function(htm)
-526 		{
+441 				return oldValue;
+442 			}
+443 		},
+444 		/**
+445 		 * Sets or retrieves a css property of the element
+446 		 * specified by the current selector. If a value is
+447 		 * passed, it will set that value on the current element,
+448 		 * otherwise it will return the value of the css property
+449 		 * on the current element
+450 		 *
+451 		 * @name css
+452 		 * @memberOf $_.dom
+453 		 * @function
+454 		 * @param string property
+455 		 * @param [string] value
+456 		 * @return string
+457 		 * @type string
+458 		 */
+459 		css: function (prop, val)
+460 		{
+461 			//Return the current value if a value is not set
+462 			if(typeof val === "undefined")
+463 			{
+464 				return _css(this.el, prop);
+465 			}
+466 
+467 			$_.each(function (e){
+468 				_css(e, prop, val);
+469 			});
+470 		},
+471 		/**
+472 		 * Adds to the innerHTML of the current element, after the last child.
+473 		 *
+474 		 * @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
+475 		 * @name append
+476 		 * @memberOf $_.dom
+477 		 * @function
+478 		 * @param string htm
+479 		 */
+480 		append: function(htm)
+481 		{
+482 			if(typeof document.insertAdjacentHTML !== "undefined")
+483 			{
+484 				this.el.insertAdjacentHTML('beforeend', htm);
+485 			}
+486 			else
+487 			{
+488 				this.el.innerHTML += htm;
+489 			}
+490 		},
+491 		/**
+492 		 * Adds to the innerHTML of the selected element, before the current children
+493 		 *
+494 		 * @name prepend
+495 		 * @memberOf $_.dom
+496 		 * @function
+497 		 * @param string htm
+498 		 */
+499 		 prepend: function(htm)
+500 		 {
+501 		 	if(typeof document.insertAdjacentHTML !== "undefined")
+502 		 	{
+503 		 		this.el.insertAdjacentHTML('afterbegin', htm);
+504 		 	}
+505 		 	else
+506 		 	{
+507 		 		this.el.innerHTML = htm + this.el.innerHTML;
+508 		 	}
+509 		 },
+510 		/**
+511 		 * Sets or gets the innerHTML propery of the element(s) passed
+512 		 *
+513 		 * @name html
+514 		 * @memberOf $_.dom
+515 		 * @function
+516 		 * @param [string] htm
+517 		 * @return string
+518 		 * @type string
+519 		 */
+520 		html: function(htm)
+521 		{
+522 
+523 			if(typeof htm !== "undefined")
+524 			{
+525 				this.el.innerHTML = htm;
+526 			}
 527 
-528 			if(typeof htm !== "undefined")
-529 			{
-530 				this.el.innerHTML = htm;
-531 			}
+528 			//If the parameter is undefined, just return the current value
+529 			return this.el.innerHTML;
+530 		}
+531 	};
 532 
-533 			//If the parameter is undefined, just return the current value
-534 			return this.el.innerHTML;
-535 		}
-536 	};
-537 
-538 	$_.ext('dom', d);
-539 
-540 }());
\ No newline at end of file +533
$_.ext('dom', d); +534 +535 }());
\ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_event.js.html b/docs/symbols/src/kis-js_src_modules_event.js.html index ebc7751..68e3e6d 100755 --- a/docs/symbols/src/kis-js_src_modules_event.js.html +++ b/docs/symbols/src/kis-js_src_modules_event.js.html @@ -74,189 +74,183 @@ 67 _listener: _listener 68 }); 69 } - 70 else - 71 { - 72 console.log("Failed to _attach event:"+event+" on "+sel); - 73 } - 74 }; - 75 /** - 76 * @private - 77 */ - 78 _remove = function (sel, event, callback) - 79 { - 80 if(typeof sel.detachEvent !== "undefined") - 81 { - 82 var expando = sel[kis_expando]; - 83 if (expando && expando.listeners - 84 && expando.listeners[event]) - 85 { - 86 var listeners = expando.listeners[event]; - 87 var len = listeners.length; - 88 for (var i=0; i<len; i++) - 89 { - 90 if (listeners[i].callback === callback) - 91 { - 92 sel.detachEvent("on" + event, listeners[i]._listener); - 93 listeners.splice(i, 1); - 94 if(listeners.length === 0) - 95 { - 96 delete expando.listeners[event]; - 97 } - 98 return; - 99 } -100 } -101 } -102 } -103 }; -104 } + 70 }; + 71 /** + 72 * @private + 73 */ + 74 _remove = function (sel, event, callback) + 75 { + 76 if(typeof sel.detachEvent !== "undefined") + 77 { + 78 var expando = sel[kis_expando]; + 79 if (expando && expando.listeners + 80 && expando.listeners[event]) + 81 { + 82 var listeners = expando.listeners[event]; + 83 var len = listeners.length; + 84 for (var i=0; i<len; i++) + 85 { + 86 if (listeners[i].callback === callback) + 87 { + 88 sel.detachEvent("on" + event, listeners[i]._listener); + 89 listeners.splice(i, 1); + 90 if(listeners.length === 0) + 91 { + 92 delete expando.listeners[event]; + 93 } + 94 return; + 95 } + 96 } + 97 } + 98 } + 99 }; +100 } +101 +102 _add_remove = function (sel, event, callback, add) +103 { +104 var i, len; 105 -106 _add_remove = function (sel, event, callback, add) -107 { -108 var i, len; -109 -110 if(typeof sel === "undefined") -111 { -112 console.log(arguments); -113 console.log(event); -114 return false; -115 } -116 -117 // Multiple events? Run recursively! -118 if ( ! event.match(/^([\w\-]+)$/)) -119 { -120 event = event.split(" "); -121 -122 len = event.length; -123 -124 for (i = 0; i < len; i++) -125 { -126 _add_remove(sel, event[i], callback, add); -127 } -128 -129 return; +106 if(typeof sel === "undefined") +107 { +108 return null; +109 } +110 +111 // Multiple events? Run recursively! +112 if ( ! event.match(/^([\w\-]+)$/)) +113 { +114 event = event.split(" "); +115 +116 len = event.length; +117 +118 for (i = 0; i < len; i++) +119 { +120 _add_remove(sel, event[i], callback, add); +121 } +122 +123 return; +124 } +125 +126 +127 if(add === true) +128 { +129 _attach(sel, event, callback); 130 } -131 -132 -133 if(add === true) -134 { -135 _attach(sel, event, callback); -136 } -137 else -138 { -139 _remove(sel, event, callback); -140 } -141 }; -142 -143 _attach_delegate = function(sel, target, event, callback) -144 { -145 // attach the listener to the parent object -146 _add_remove(sel, event, function(e){ -147 -148 var elem, t, tar; +131 else +132 { +133 _remove(sel, event, callback); +134 } +135 }; +136 +137 _attach_delegate = function(sel, target, event, callback) +138 { +139 // attach the listener to the parent object +140 _add_remove(sel, event, function(e){ +141 +142 var elem, t, tar; +143 +144 // IE 8 doesn't have event bound to element +145 e = e || window.event; +146 +147 // Get the live version of the target selector +148 t = $_.$(target, sel); 149 -150 // IE 8 doesn't have event bound to element -151 e = e || window.event; -152 -153 // Get the live version of the target selector -154 t = $_.$(target, sel); +150 // Check each element to see if it matches the target +151 for(elem in t) +152 { +153 // IE 8 doesn't have target in the event object +154 tar = e.target || e.srcElement; 155 -156 // Check each element to see if it matches the target -157 for(elem in t) -158 { -159 // IE 8 doesn't have target in the event object -160 tar = e.target || e.srcElement; +156 // Fire target callback when event bubbles from target +157 if(tar == t[elem]) +158 { +159 // Trigger the event callback +160 callback.call(t[elem], e); 161 -162 // Fire target callback when event bubbles from target -163 if(tar == t[elem]) -164 { -165 // Trigger the event callback -166 callback.call(t[elem], e); -167 -168 // Stop event propegation -169 e.stopPropagation(); -170 } -171 } -172 -173 }, true); -174 }; -175 -176 // -------------------------------------------------------------------------- -177 -178 /** -179 * Event Listener module -180 * -181 * @namespace -182 * @name event -183 * @memberOf $_ -184 */ -185 e = { -186 /** -187 * Adds an event that returns a callback when triggered on the selected -188 * event and selector -189 * -190 * @memberOf $_.event -191 * @name add -192 * @function -193 * @example Eg. $_("#selector").event.add("click", do_something()); -194 * @param string event -195 * @param function callback -196 */ -197 add: function (event, callback) -198 { -199 $_.each(function(e){ -200 _add_remove(e, event, callback, true); -201 }); -202 }, -203 /** -204 * Removes an event bound the the specified selector, event type, and callback -205 * -206 * @memberOf $_.event -207 * @name remove -208 * @function -209 * @example Eg. $_("#selector").event.remove("click", do_something()); -210 * @param string event -211 * @param string callback -212 */ -213 remove: function (event, callback) -214 { -215 $_.each(function(e){ -216 _add_remove(e, event, callback, false); -217 }); -218 }, -219 /** -220 * Binds a persistent event to the document -221 * -222 * @memberOf $_.event -223 * @name live -224 * @function -225 * @example Eg. $_.event.live(".button", "click", do_something()); -226 * @param string target -227 * @param string event -228 * @param function callback -229 */ -230 live: function (target, event, callback) -231 { -232 _attach_delegate(document.documentElement, target, event, callback); -233 }, -234 /** -235 * Binds an event to a parent object -236 * -237 * @memberOf $_.event -238 * @name delegate -239 * @function -240 * @example Eg. $_("#parent").delegate(".button", "click", do_something()); -241 * @param string target -242 * @param string event_type -243 * @param function callback -244 */ -245 delegate: function (target, event, callback) -246 { -247 $_.each(function(e){ -248 _attach_delegate(e, target, event, callback); -249 }); -250 } -251 }; -252 -253 $_.ext('event', e); -254 -255 }()); \ No newline at end of file +162 // Stop event propegation +163 e.stopPropagation(); +164 } +165 } +166 +167 }, true); +168 }; +169 +170 // -------------------------------------------------------------------------- +171 +172 /** +173 * Event Listener module +174 * +175 * @namespace +176 * @name event +177 * @memberOf $_ +178 */ +179 e = { +180 /** +181 * Adds an event that returns a callback when triggered on the selected +182 * event and selector +183 * +184 * @memberOf $_.event +185 * @name add +186 * @function +187 * @example Eg. $_("#selector").event.add("click", do_something()); +188 * @param string event +189 * @param function callback +190 */ +191 add: function (event, callback) +192 { +193 $_.each(function(e){ +194 _add_remove(e, event, callback, true); +195 }); +196 }, +197 /** +198 * Removes an event bound the the specified selector, event type, and callback +199 * +200 * @memberOf $_.event +201 * @name remove +202 * @function +203 * @example Eg. $_("#selector").event.remove("click", do_something()); +204 * @param string event +205 * @param string callback +206 */ +207 remove: function (event, callback) +208 { +209 $_.each(function(e){ +210 _add_remove(e, event, callback, false); +211 }); +212 }, +213 /** +214 * Binds a persistent event to the document +215 * +216 * @memberOf $_.event +217 * @name live +218 * @function +219 * @example Eg. $_.event.live(".button", "click", do_something()); +220 * @param string target +221 * @param string event +222 * @param function callback +223 */ +224 live: function (target, event, callback) +225 { +226 _attach_delegate(document.documentElement, target, event, callback); +227 }, +228 /** +229 * Binds an event to a parent object +230 * +231 * @memberOf $_.event +232 * @name delegate +233 * @function +234 * @example Eg. $_("#parent").delegate(".button", "click", do_something()); +235 * @param string target +236 * @param string event_type +237 * @param function callback +238 */ +239 delegate: function (target, event, callback) +240 { +241 $_.each(function(e){ +242 _attach_delegate(e, target, event, callback); +243 }); +244 } +245 }; +246 +247 $_.ext('event', e); +248 +249 }()); \ No newline at end of file diff --git a/kis-all.js b/kis-all.js index 1d43372..e473a4d 100755 --- a/kis-all.js +++ b/kis-all.js @@ -224,16 +224,6 @@ * @file polyfill.js */ -// Console.log polyfill for IE 8 stupidity -if(typeof window.console === "undefined") -{ - window.console = { - log:function(){} - }; -} - -// -------------------------------------------------------------------------- - /** * String trim function polyfill */ @@ -289,7 +279,7 @@ if (typeof Array.isArray === "undefined") // -------------------------------------------------------------------------- -//This is used so IE 8 can use the classList api +//This is used so IE can use the classList api /* * classList.js: Cross-browser full element.classList implementation. * 2011-06-15 @@ -495,9 +485,9 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" //Well, I guess that attribute doesn't exist if (typeof oldVal === "undefined" && (typeof value === "undefined" || value === null)) { - console.log(value); + /*console.log(value); console.log(sel); - console.log("Element does not have the selected attribute"); + console.log("Element does not have the selected attribute");*/ return null; } @@ -583,9 +573,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" sel.style[equi[prop]] = val; return null; } - - //No matches? Well, lets log it for now - console.log("Property " + prop + " nor an equivalent seems to exist"); } // -------------------------------------------------------------------------- @@ -681,9 +668,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" //Make sure you don't try to get a bunch of elements if (sel.length > 1 && typeof value === "undefined") { - console.log(sel); - console.log("Must be a singular element"); - return; + return null; } else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though { @@ -1047,10 +1032,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" _listener: _listener }); } - else - { - console.log("Failed to _attach event:"+event+" on "+sel); - } }; /** * @private @@ -1089,9 +1070,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" if(typeof sel === "undefined") { - console.log(arguments); - console.log(event); - return false; + return null; } // Multiple events? Run recursively! diff --git a/kis-lite-dom-min.js b/kis-lite-dom-min.js index c421a0c..d55fd69 100755 --- a/kis-lite-dom-min.js +++ b/kis-lite-dom-min.js @@ -1,17 +1,17 @@ -(function(){if("undefined"!==typeof document.querySelector){var e,g,f,b;e=function(a){b="undefined"===typeof a?"undefined"!==typeof e.el?e.el:document.documentElement:"object"!==typeof a?g(a):a;e.prototype.el=b;var a=f(e),d;for(d in a)"object"===typeof a[d]&&(a[d].el=b);a.el=b;return a};g=function(a,d){var b;if("string"!=typeof a||"undefined"===typeof a)return a;b=null!=d&&1===d.nodeType?d:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=b.querySelectorAll(a); -return 1===b.length?b[0]:b};f=function(a){var d;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);d=typeof a;if(!("object"!==d&&"function"!==d))return d=function(){},d.prototype=a,new d}};e.ext=function(a,d){d.el=b;e[a]=d};e.ext("each",function(a){if("undefined"!==typeof b.length&&b!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(b,a);else{var d=b.length;if(0!==d)for(var c,h=0;h1&&typeof a==="undefined"){console.log(d);console.log("Must be a singular element")}else if(d.length> -1&&typeof a!=="undefined")$_.each(function(c){return e(c,b,a)});else return e(d,b,a)},text:function(b){var a,d,c;c=this.el;d=typeof c.textContent!=="undefined"?"textContent":typeof c.innerText!=="undefined"?"innerText":"innerHTML";a=c[d];if(typeof b!=="undefined")return c[d]=b;return a},css:function(b,a){if(typeof a==="undefined")return f(this.el,b);$_.each(function(d){f(d,b,a)})},append:function(b){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("beforeend",b):this.el.innerHTML= -this.el.innerHTML+b},prepend:function(b){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("afterbegin",b):this.el.innerHTML=b+this.el.innerHTML},html:function(b){if(typeof b!=="undefined")this.el.innerHTML=b;return this.el.innerHTML}})})(); +(function(){if("undefined"!==typeof document.querySelector){var c,g,e,a;c=function(b){a="undefined"===typeof b?"undefined"!==typeof c.el?c.el:document.documentElement:"object"!==typeof b?g(b):b;c.prototype.el=a;var b=e(c),f;for(f in b)"object"===typeof b[f]&&(b[f].el=a);b.el=a;return b};g=function(b,f){var a;if("string"!=typeof b||"undefined"===typeof b)return b;a=null!=f&&1===f.nodeType?f:document;if(b.match(/^#([\w\-]+$)/))return document.getElementById(b.split("#")[1]);a=a.querySelectorAll(b); +return 1===a.length?a[0]:a};e=function(b){var a;if("undefined"!==typeof b){if("undefined"!==typeof Object.create)return Object.create(b);a=typeof b;if(!("object"!==a&&"function"!==a))return a=function(){},a.prototype=b,new a}};c.ext=function(b,f){f.el=a;c[b]=f};c.ext("each",function(b){if("undefined"!==typeof a.length&&a!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(a,b);else{var f=a.length;if(0!==f)for(var d,h=0;h1&&typeof b==="undefined")return null;if(e.length>1&&typeof b!=="undefined")$_.each(function(d){return c(d,a,b)});else return c(e,a,b)},text:function(a){var b,c,d;d=this.el;c=typeof d.textContent!=="undefined"?"textContent":typeof d.innerText!=="undefined"?"innerText": +"innerHTML";b=d[c];if(typeof a!=="undefined")return d[c]=a;return b},css:function(a,b){if(typeof b==="undefined")return e(this.el,a);$_.each(function(c){e(c,a,b)})},append:function(a){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("beforeend",a):this.el.innerHTML=this.el.innerHTML+a},prepend:function(a){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("afterbegin",a):this.el.innerHTML=a+this.el.innerHTML},html:function(a){if(typeof a!=="undefined")this.el.innerHTML= +a;return this.el.innerHTML}})})(); diff --git a/kis-lite-dom.js b/kis-lite-dom.js index 565ed23..9382348 100755 --- a/kis-lite-dom.js +++ b/kis-lite-dom.js @@ -224,16 +224,6 @@ * @file polyfill.js */ -// Console.log polyfill for IE 8 stupidity -if(typeof window.console === "undefined") -{ - window.console = { - log:function(){} - }; -} - -// -------------------------------------------------------------------------- - /** * String trim function polyfill */ @@ -502,10 +492,6 @@ if (typeof Array.isArray === "undefined") _listener: _listener }); } - else - { - console.log("Failed to _attach event:"+event+" on "+sel); - } }; /** * @private @@ -544,9 +530,7 @@ if (typeof Array.isArray === "undefined") if(typeof sel === "undefined") { - console.log(arguments); - console.log(event); - return false; + return null; } // Multiple events? Run recursively! @@ -691,7 +675,7 @@ if (typeof Array.isArray === "undefined") // -------------------------------------------------------------------------- -//This is used so IE 8 can use the classList api +//This is used so IE can use the classList api /* * classList.js: Cross-browser full element.classList implementation. * 2011-06-15 @@ -899,9 +883,9 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" //Well, I guess that attribute doesn't exist if (typeof oldVal === "undefined" && (typeof value === "undefined" || value === null)) { - console.log(value); + /*console.log(value); console.log(sel); - console.log("Element does not have the selected attribute"); + console.log("Element does not have the selected attribute");*/ return null; } @@ -987,9 +971,6 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" sel.style[equi[prop]] = val; return null; } - - //No matches? Well, lets log it for now - console.log("Property " + prop + " nor an equivalent seems to exist"); } // -------------------------------------------------------------------------- @@ -1085,9 +1066,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" //Make sure you don't try to get a bunch of elements if (sel.length > 1 && typeof value === "undefined") { - console.log(sel); - console.log("Must be a singular element"); - return; + return null; } else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though { diff --git a/kis-lite-min.js b/kis-lite-min.js index af76adb..e5f42b9 100755 --- a/kis-lite-min.js +++ b/kis-lite-min.js @@ -1,9 +1,9 @@ -(function(){if("undefined"!==typeof document.querySelector){var f,g,d,c;f=function(a){c="undefined"===typeof a?"undefined"!==typeof f.el?f.el:document.documentElement:"object"!==typeof a?g(a):a;f.prototype.el=c;var a=d(f),b;for(b in a)"object"===typeof a[b]&&(a[b].el=c);a.el=c;return a};g=function(a,b){var e;if("string"!=typeof a||"undefined"===typeof a)return a;e=null!=b&&1===b.nodeType?b:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);e=e.querySelectorAll(a); -return 1===e.length?e[0]:e};d=function(a){var b;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);b=typeof a;if(!("object"!==b&&"function"!==b))return b=function(){},b.prototype=a,new b}};f.ext=function(a,b){b.el=c;f[a]=b};f.ext("each",function(a){if("undefined"!==typeof c.length&&c!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(c,a);else{var b=c.length;if(0!==b)for(var e,d=0;d1&&typeof b==="undefined"){console.log(c);console.log("Must be a singular element")}else if(c.length> -1&&typeof b!=="undefined")d.each(function(c){return o(c,a,b)});else return o(c,a,b)},text:function(a){var b,c,f;f=this.el;c=typeof f.textContent!=="undefined"?"textContent":typeof f.innerText!=="undefined"?"innerText":"innerHTML";b=f[c];if(typeof a!=="undefined")return f[c]=a;return b},css:function(a,b){if(typeof b==="undefined")return e(this.el,a);d.each(function(c){e(c,a,b)})},append:function(a){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("beforeend",a):this.el.innerHTML= -this.el.innerHTML+a},prepend:function(a){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("afterbegin",a):this.el.innerHTML=a+this.el.innerHTML},html:function(a){if(typeof a!=="undefined")this.el.innerHTML=a;return this.el.innerHTML}});if(typeof window.XMLHttpRequest!=="undefined"){var g={_do:function(a,b,c,f,j){var d=new XMLHttpRequest;typeof c==="undefined"&&(c=function(){});j=j?"POST":"GET";a=a+(j==="GET"?"?"+this._serialize(b):"");d.open(j,a);d.onreadystatechange=function(){d.readyState=== -4&&(d.status===200?c.call(d.responseText,d.responseText):typeof f!=="undefined"&&f.call(d.status,d.status))};if(j==="POST"){d.setRequestHeader("Content-Type","application/x-www-form-urlencoded");d.send(this._serialize(b))}else d.send(null)},_serialize:function(a){var b,c,f=[];for(b in a)if(a.hasOwnProperty(b)&&typeof a[b]!=="function"){c=a[b].toString();b=encodeURIComponent(b);c=encodeURIComponent(c);f.push(b+"="+c)}return f.join("&")}};d.ext("get",function(a,b,c,f){g._do(a,b,c,f,false)});d.ext("post", -function(a,b,c,f){g._do(a,b,c,f,true)});d.ext("sse",function(a,b){var c;if(typeof EventSource!=="undefined"){c=new EventSource(a);c.onmessage=function(a){b.call(a.data,a.data)}}});var i,l,k,q;if(typeof document.addEventListener!=="undefined"){i=function(a,b,c){typeof a.addEventListener!=="undefined"&&a.addEventListener(b,c,false)};l=function(a,b,c){typeof a.removeEventListener!=="undefined"&&a.removeEventListener(b,c,false)}}else if(typeof document.attachEvent!=="undefined"){i=function(a,b,c){function f(a){c.apply(a)} -if(typeof a.attachEvent!=="undefined"){l(b,c);a.attachEvent("on"+b,f);a=a.KIS_0_6_0=a.KIS_0_6_0||{};a.listeners=a.listeners||{};a.listeners[b]=a.listeners[b]||[];a.listeners[b].push({callback:c,_listener:f})}else console.log("Failed to _attach event:"+b+" on "+a)};l=function(a,b,c){if(typeof a.detachEvent!=="undefined"){var f=a.KIS_0_6_0;if(f&&f.listeners&&f.listeners[b])for(var d=f.listeners[b],e=d.length,h=0;hd?1:ca?1:b1&&typeof b==="undefined")return null;if(c.length>1&&typeof b!=="undefined")d.each(function(c){return o(c,a,b)});else return o(c,a,b)},text:function(a){var b,c,f;f=this.el;c=typeof f.textContent!=="undefined"?"textContent":typeof f.innerText!=="undefined"?"innerText": +"innerHTML";b=f[c];if(typeof a!=="undefined")return f[c]=a;return b},css:function(a,b){if(typeof b==="undefined")return e(this.el,a);d.each(function(c){e(c,a,b)})},append:function(a){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("beforeend",a):this.el.innerHTML=this.el.innerHTML+a},prepend:function(a){typeof document.insertAdjacentHTML!=="undefined"?this.el.insertAdjacentHTML("afterbegin",a):this.el.innerHTML=a+this.el.innerHTML},html:function(a){if(typeof a!=="undefined")this.el.innerHTML= +a;return this.el.innerHTML}});if(typeof window.XMLHttpRequest!=="undefined"){var g={_do:function(a,b,c,f,j){var d=new XMLHttpRequest;typeof c==="undefined"&&(c=function(){});j=j?"POST":"GET";a=a+(j==="GET"?"?"+this._serialize(b):"");d.open(j,a);d.onreadystatechange=function(){d.readyState===4&&(d.status===200?c.call(d.responseText,d.responseText):typeof f!=="undefined"&&f.call(d.status,d.status))};if(j==="POST"){d.setRequestHeader("Content-Type","application/x-www-form-urlencoded");d.send(this._serialize(b))}else d.send(null)}, +_serialize:function(a){var b,c,f=[];for(b in a)if(a.hasOwnProperty(b)&&typeof a[b]!=="function"){c=a[b].toString();b=encodeURIComponent(b);c=encodeURIComponent(c);f.push(b+"="+c)}return f.join("&")}};d.ext("get",function(a,b,c,f){g._do(a,b,c,f,false)});d.ext("post",function(a,b,c,f){g._do(a,b,c,f,true)});d.ext("sse",function(a,b){var c;if(typeof EventSource!=="undefined"){c=new EventSource(a);c.onmessage=function(a){b.call(a.data,a.data)}}});var i,l,k,q;if(typeof document.addEventListener!=="undefined"){i= +function(a,b,c){typeof a.addEventListener!=="undefined"&&a.addEventListener(b,c,false)};l=function(a,b,c){typeof a.removeEventListener!=="undefined"&&a.removeEventListener(b,c,false)}}else if(typeof document.attachEvent!=="undefined"){i=function(a,b,c){function f(a){c.apply(a)}if(typeof a.attachEvent!=="undefined"){l(b,c);a.attachEvent("on"+b,f);a=a.KIS_0_6_0=a.KIS_0_6_0||{};a.listeners=a.listeners||{};a.listeners[b]=a.listeners[b]||[];a.listeners[b].push({callback:c,_listener:f})}};l=function(a, +b,c){if(typeof a.detachEvent!=="undefined"){var f=a.KIS_0_6_0;if(f&&f.listeners&&f.listeners[b])for(var d=f.listeners[b],e=d.length,h=0;hd?1:ca?1:b 1 && typeof value === "undefined") { - console.log(sel); - console.log("Must be a singular element"); - return; + return null; } else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though { diff --git a/src/modules/event.js b/src/modules/event.js index b38f051..8377e8b 100755 --- a/src/modules/event.js +++ b/src/modules/event.js @@ -67,10 +67,6 @@ _listener: _listener }); } - else - { - console.log("Failed to _attach event:"+event+" on "+sel); - } }; /** * @private @@ -109,9 +105,7 @@ if(typeof sel === "undefined") { - console.log(arguments); - console.log(event); - return false; + return null; } // Multiple events? Run recursively! diff --git a/src/polyfill.js b/src/polyfill.js index a2c04d2..7a6e206 100755 --- a/src/polyfill.js +++ b/src/polyfill.js @@ -3,16 +3,6 @@ * @file polyfill.js */ -// Console.log polyfill for IE 8 stupidity -if(typeof window.console === "undefined") -{ - window.console = { - log:function(){} - }; -} - -// -------------------------------------------------------------------------- - /** * String trim function polyfill */