From 67991ae40d1d089b8e6c8116b07b0dae0de08a15 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Wed, 19 Jun 2013 10:13:21 -0400 Subject: [PATCH] Updated undefined checks for smaller minified script. --- docs/symbols/src/kis-js_src_core.js.html | 20 +- .../src/kis-js_src_modules_DOM.js.html | 875 +++++++----------- .../src/kis-js_src_modules_ajax.js.html | 10 +- .../src/kis-js_src_modules_event.js.html | 6 +- .../src/kis-js_src_modules_store.js.html | 4 +- .../src/kis-js_src_modules_util.js.html | 2 +- kis-all.js | 243 +---- kis-lite-dom-min.js | 29 +- kis-lite-dom.js | 245 +---- kis-lite-min.js | 14 +- kis-lite.js | 36 +- kis-min.js | 34 +- src/core.js | 20 +- src/modules/DOM.js | 209 +---- src/modules/ajax.js | 10 +- src/modules/event.js | 6 +- src/modules/store.js | 4 +- src/modules/util.js | 2 +- 18 files changed, 555 insertions(+), 1214 deletions(-) mode change 100644 => 100755 src/core.js mode change 100644 => 100755 src/modules/DOM.js mode change 100644 => 100755 src/modules/ajax.js mode change 100644 => 100755 src/modules/event.js mode change 100644 => 100755 src/modules/util.js diff --git a/docs/symbols/src/kis-js_src_core.js.html b/docs/symbols/src/kis-js_src_core.js.html index 9f475c5..9d5ff98 100755 --- a/docs/symbols/src/kis-js_src_core.js.html +++ b/docs/symbols/src/kis-js_src_core.js.html @@ -9,9 +9,9 @@ 2 Kis JS Keep It Simple JS Library 3 Copyright Timothy J. Warren 4 License Public Domain - 5 Version 0.7.0 + 5 Version 0.8.0 6 */ - 7 (function (){ + 7 (function (undefined){ 8 9 "use strict"; 10 @@ -21,7 +21,7 @@ 14 // selector engine. I choose to just use the 15 // browser feature, since it is present in 16 // IE 8+, and all other major browsers - 17 if (typeof document.querySelector === "undefined") + 17 if (document.querySelector === undefined) 18 { 19 return; 20 } @@ -42,10 +42,10 @@ 35 $_ = function(s) 36 { 37 // Have documentElement be default selector, just in case - 38 if (typeof s === "undefined") + 38 if (s === undefined) 39 { 40 // Defines a "global" selector for that instance - 41 sel = (typeof $_.el !== "undefined") + 41 sel = ($_.el !== undefined) 42 ? $_.el 43 : document.documentElement; 44 } @@ -87,7 +87,7 @@ 80 { 81 var x, c; 82 - 83 if (typeof a != "string" || typeof a === "undefined"){ return a;} + 83 if (typeof a != "string" || a === undefined){ return a;} 84 85 //Check for a context of a specific element, otherwise, just run on the document 86 c = (context != null && context.nodeType === 1) @@ -120,12 +120,12 @@ 113 { 114 var type, F; 115 -116 if(typeof obj === "undefined") +116 if(obj === undefined) 117 { 118 return; 119 } 120 -121 if(typeof Object.create !== "undefined") +121 if(Object.create !== undefined) 122 { 123 return Object.create(obj); 124 } @@ -169,10 +169,10 @@ 162 */ 163 $_.ext('each', function (callback) 164 { -165 if(typeof sel.length !== "undefined" && sel !== window) +165 if(sel.length !== undefined && sel !== window) 166 { 167 // Use the native method, if it exists -168 if(typeof Array.prototype.forEach !== 'undefined') +168 if(Array.prototype.forEach !== undefined) 169 { 170 [].forEach.call(sel, callback); 171 return; 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 f2131d1..1814172 100755 --- a/docs/symbols/src/kis-js_src_modules_DOM.js.html +++ b/docs/symbols/src/kis-js_src_modules_DOM.js.html @@ -6,530 +6,365 @@ .REGX {color: #339;} .line {border-right: 1px dotted #666; color: #666; font-style: normal;}
  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
-  5  *
-  6  * By Eli Grey, http://eligrey.com
-  7  * Public Domain.
-  8  * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+  2 /*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js*/
+  3 if(typeof document!=="undefined"&&!("classList" in document.createElement("a"))){(function(j){if(!("HTMLElement" in j)&&!("Element" in j)){return}var a="classList",f="prototype",m=(j.HTMLElement||j.Element)[f],b=Object,k=String[f].trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array[f].indexOf||function(q){var p=0,o=this.length;for(;p<o;p++){if(p in this&&this[p]===q){return p}}return -1},n=function(o,p){this.name=o;this.code=DOMException[o];this.message=p},g=function(p,o){if(o===""){throw new n("SYNTAX_ERR","An invalid or illegal string was specified")}if(/\s/.test(o)){throw new n("INVALID_CHARACTER_ERR","String contains an invalid character")}return c.call(p,o)},d=function(s){var r=k.call(s.className),q=r?r.split(/\s+/):[],p=0,o=q.length;for(;p<o;p++){this.push(q[p])}this._updateClassName=function(){s.className=this.toString()}},e=d[f]=[],i=function(){return new d(this)};n[f]=Error[f];e.item=function(o){return this[o]||null};e.contains=function(o){o+="";return g(this,o)!==-1};e.add=function(){var s=arguments,r=0,p=s.length,q,o=false;do{q=s[r]+"";if(g(this,q)===-1){this.push(q);o=true}}while(++r<p);if(o){this._updateClassName()}};e.remove=function(){var t=arguments,s=0,p=t.length,r,o=false;do{r=t[s]+"";var q=g(this,r);if(q!==-1){this.splice(q,1);o=true}}while(++s<p);if(o){this._updateClassName()}};e.toggle=function(p,q){p+="";var o=this.contains(p),r=o?q!==true&&"remove":q!==false&&"add";if(r){this[r](p)}return !o};e.toString=function(){return this.join(" ")};if(b.defineProperty){var l={get:i,enumerable:true,configurable:true};try{b.defineProperty(m,a,l)}catch(h){if(h.number===-2146823252){l.enumerable=false;b.defineProperty(m,a,l)}}}else{if(b[f].__defineGetter__){m.__defineGetter__(a,i)}}}(self))};
+  4 
+  5 /**
+  6  * DOM
+  7  *
+  8  * Dom manipulation module
   9  */
- 10 if (typeof document !== "undefined" && !("classList" in document.createElement("a")))
- 11 {
- 12 	(function (view){
+ 10 (function (undefined){
+ 11 
+ 12 	"use strict";
  13 
- 14 		var classListProp = "classList",
- 15 			protoProp = "prototype",
- 16 			elemCtrProto = (view.HTMLElement || view.Element)[protoProp],
- 17 			objCtr = Object,
- 18 			strTrim = String[protoProp].trim ||
- 19 			function ()
- 20 			{
- 21 				return this.replace(/^\s+|\s+$/g, "");
- 22 			},
- 23 			arrIndexOf = Array[protoProp].indexOf ||
- 24 			function (item)
+ 14 	var d;
+ 15 
+ 16 	//Private function for getting/setting attributes/properties
+ 17 	function _attr(sel, name, value)
+ 18 	{
+ 19 		var oldVal, doAttr;
+ 20 
+ 21 		//Get the value of the attribute, if it exists
+ 22 		if (sel.hasAttribute !== undefined)
+ 23 		{
+ 24 			if (sel.hasAttribute(name))
  25 			{
- 26 				var
- 27 				i = 0,
- 28 					len = this.length;
- 29 				for (; i < len; i++)
- 30 				{
- 31 					if (i in this && this[i] === item)
- 32 					{
- 33 						return i;
- 34 					}
- 35 				}
- 36 				return -1;
- 37 			}
- 38 			// Vendors: please allow content code to instantiate DOMExceptions
- 39 			,
- 40 			/**
- 41 			 * @private
- 42 			 */
- 43 			DOMEx = function (type, message)
- 44 			{
- 45 				this.name = type;
- 46 				this.code = DOMException[type];
- 47 				this.message = message;
- 48 			},
- 49 			/**
- 50 			 * @private
- 51 			 */
- 52 			checkTokenAndGetIndex = function (classList, token)
- 53 			{
- 54 				if (token === "")
- 55 				{
- 56 					throw new DOMEx("SYNTAX_ERR", "An invalid or illegal string was specified");
- 57 				}
- 58 				if (/\s/.test(token))
- 59 				{
- 60 					throw new DOMEx("INVALID_CHARACTER_ERR", "String contains an invalid character");
- 61 				}
- 62 				return arrIndexOf.call(classList, token);
- 63 			},
- 64 			/**
- 65 			 * @private
- 66 			 */
- 67 			ClassList = function (elem)
- 68 			{
- 69 				var
- 70 				trimmedClasses = strTrim.call(elem.className),
- 71 					classes = trimmedClasses ? trimmedClasses.split(/\s+/) : [],
- 72 					i = 0,
- 73 					len = classes.length;
- 74 				for (; i < len; i++)
- 75 				{
- 76 					this.push(classes[i]);
- 77 				}
- 78 				this._updateClassName = function ()
- 79 				{
- 80 					elem.className = this.toString();
- 81 				};
- 82 			},
- 83 			classListProto = ClassList[protoProp] = [],
- 84 			/**
- 85 			 * @private
- 86 			 */
- 87 			classListGetter = function ()
- 88 			{
- 89 				return new ClassList(this);
- 90 			};
- 91 		// Most DOMException implementations don't allow calling DOMException's toString()
- 92 		// on non-DOMExceptions. Error's toString() is sufficient here.
- 93 		DOMEx[protoProp] = Error[protoProp];
- 94 		classListProto.item = function (i)
- 95 		{
- 96 			return this[i] || null;
- 97 		};
- 98 		classListProto.contains = function (token)
- 99 		{
-100 			token += "";
-101 			return checkTokenAndGetIndex(this, token) !== -1;
-102 		};
-103 		classListProto.add = function (token)
-104 		{
-105 			token += "";
-106 			if (checkTokenAndGetIndex(this, token) === -1)
-107 			{
-108 				this.push(token);
-109 				this._updateClassName();
-110 			}
-111 		};
-112 		classListProto.remove = function (token)
-113 		{
-114 			token += "";
-115 			var index = checkTokenAndGetIndex(this, token);
-116 			if (index !== -1)
-117 			{
-118 				this.splice(index, 1);
-119 				this._updateClassName();
-120 			}
-121 		};
-122 		classListProto.toggle = function (token)
-123 		{
-124 			token += "";
-125 			if (checkTokenAndGetIndex(this, token) === -1)
-126 			{
-127 				this.add(token);
-128 			}
-129 			else
-130 			{
-131 				this.remove(token);
-132 			}
-133 		};
-134 		classListProto.toString = function ()
-135 		{
-136 			return this.join(" ");
-137 		};
-138 
-139 		if (objCtr.defineProperty)
-140 		{
-141 			var classListPropDesc = {
-142 				get: classListGetter,
-143 				enumerable: true,
-144 				configurable: true
-145 			};
-146 			try
-147 			{
-148 				objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
-149 			}
-150 			catch (ex)
-151 			{ // IE 8 doesn't support enumerable:true
-152 				if (ex.number === -0x7FF5EC54)
-153 				{
-154 					classListPropDesc.enumerable = false;
-155 					objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
-156 				}
-157 			}
-158 		}
-159 		else if (objCtr[protoProp].__defineGetter__)
-160 		{
-161 			elemCtrProto.__defineGetter__(classListProp, classListGetter);
-162 		}
-163 
-164 	}(self));
-165 }
-166 
-167 /**
-168  * DOM
-169  *
-170  * Dom manipulation module
-171  */
-172 (function (){
-173 
-174 	"use strict";
-175 
-176 	var d;
-177 
-178 	//Private function for getting/setting attributes/properties
-179 	function _attr(sel, name, value)
-180 	{
-181 		var oldVal, doAttr;
-182 
-183 		//Get the value of the attribute, if it exists
-184 		if (typeof sel.hasAttribute !== "undefined")
-185 		{
-186 			if (sel.hasAttribute(name))
-187 			{
-188 				oldVal = sel.getAttribute(name);
-189 			}
-190 
-191 			doAttr = true;
-192 		}
-193 		else if (typeof sel[name] !== "undefined")
-194 		{
-195 			oldVal = sel[name];
-196 			doAttr = false;
-197 		}
-198 		else if (name === "class" && typeof sel.className !== "undefined") //className attribute
-199 		{
-200 			name = "className";
-201 			oldVal = sel.className;
-202 			doAttr = false;
-203 		}
-204 
-205 		//Well, I guess that attribute doesn't exist
-206 		if (typeof oldVal === "undefined" && (typeof value === "undefined" || value === null))
-207 		{
-208 			/*console.log(value);
-209 			console.log(sel);
-210 			console.log("Element does not have the selected attribute");*/
-211 			return null;
-212 		}
-213 
-214 		//No value to set? Return the current value
-215 		if (typeof value === "undefined")
-216 		{
-217 			return oldVal;
-218 		}
-219 
-220 		//Determine what to do with the attribute
-221 		if (typeof value !== "undefined" && value !== null)
-222 		{
-223 			if(doAttr === true)
-224 			{
-225 				sel.setAttribute(name, value);
-226 			}
-227 			else
-228 			{
-229 				sel[name] = value;
-230 			}
-231 		}
-232 		else if (value === null)
-233 		{
-234 			if(doAttr === true)
+ 26 				oldVal = sel.getAttribute(name);
+ 27 			}
+ 28 
+ 29 			doAttr = true;
+ 30 		}
+ 31 		else if (sel[name] !== undefined)
+ 32 		{
+ 33 			oldVal = sel[name];
+ 34 			doAttr = false;
+ 35 		}
+ 36 		else if (name === "class" && sel.className !== undefined) //className attribute
+ 37 		{
+ 38 			name = "className";
+ 39 			oldVal = sel.className;
+ 40 			doAttr = false;
+ 41 		}
+ 42 
+ 43 		//Well, I guess that attribute doesn't exist
+ 44 		if (oldVal === undefined && (value === undefined || value === null))
+ 45 		{
+ 46 			return null;
+ 47 		}
+ 48 
+ 49 		//No value to set? Return the current value
+ 50 		if (value === undefined)
+ 51 		{
+ 52 			return oldVal;
+ 53 		}
+ 54 
+ 55 		//Determine what to do with the attribute
+ 56 		if (value !== undefined && value !== null)
+ 57 		{
+ 58 			if(doAttr === true)
+ 59 			{
+ 60 				sel.setAttribute(name, value);
+ 61 			}
+ 62 			else
+ 63 			{
+ 64 				sel[name] = value;
+ 65 			}
+ 66 		}
+ 67 		else if (value === null)
+ 68 		{
+ 69 			if(doAttr === true)
+ 70 			{
+ 71 				sel.removeAttribute(name);
+ 72 			}
+ 73 			else
+ 74 			{
+ 75 				delete sel[name];
+ 76 			}
+ 77 		}
+ 78 
+ 79 		return (value !== undefined) ? value : oldVal;
+ 80 	}
+ 81 
+ 82 	/**
+ 83 	 * Change css property name to it's
+ 84 	 * javascript camel case equivalent
+ 85 	 */
+ 86 	function _toCamel(s)
+ 87 	{
+ 88 		return s.replace(/(\-[a-z])/g, function($1){
+ 89 			return $1.toUpperCase().replace('-','');
+ 90 		});
+ 91 	}
+ 92 
+ 93 	function _css(sel, prop, val)
+ 94 	{
+ 95 		var equi;
+ 96 
+ 97 		//Camel-case
+ 98 		prop = _toCamel(prop);
+ 99 
+100 		//Equivalent properties for 'special' browsers
+101 		equi = {
+102 			outerHeight: "offsetHeight",
+103 			outerWidth: "offsetWidth",
+104 			top: "posTop"
+105 		};
+106 
+107 
+108 		//If you don't define a value, try returning the existing value
+109 		if(val === undefined && sel.style[prop] !== undefined)
+110 		{
+111 			return sel.style[prop];
+112 		}
+113 		else if(val === undefined && sel.style[equi[prop]] !== undefined)
+114 		{
+115 			return sel.style[equi[prop]];
+116 		}
+117 
+118 		//Let's try the easy way first
+119 		if(sel.style[prop] !== undefined)
+120 		{
+121 			sel.style[prop] = val;
+122 
+123 			//Short circuit
+124 			return null;
+125 		}
+126 		else if(sel.style[equi[prop]])
+127 		{
+128 			sel.style[equi[prop]] = val;
+129 			return null;
+130 		}
+131 	}
+132 
+133 	// --------------------------------------------------------------------------
+134 
+135 	/**
+136 	 * DOM
+137 	 *
+138 	 * Dom manipulation module
+139 	 * @namespace
+140 	 * @memberOf $_
+141 	 * @name dom
+142 	 */
+143 	d = {
+144 		/**
+145 		 * Adds a class to the element(s) specified by the current
+146 		 * selector
+147 		 *
+148 		 * @name addClass
+149 		 * @memberOf $_.dom
+150 		 * @function
+151 		 * @param string class
+152 		 */
+153 		addClass: function (c)
+154 		{
+155 			$_.each(function (e){
+156 				this.classList.add(c);
+157 			});
+158 		},
+159 		/**
+160 		 * Removes a class from the element(s) specified by the current
+161 		 * selector
+162 		 *
+163 		 * @name removeClass
+164 		 * @memberOf $_.dom
+165 		 * @function
+166 		 * @param string class
+167 		 */
+168 		removeClass: function (c)
+169 		{
+170 			$_.each(function (e){
+171 				e.classList.remove(c);
+172 			});
+173 		},
+174 		/**
+175 		 * Hides the element(s) specified by the current selector
+176 		 *
+177 		 * @name hide
+178 		 * @memberOf $_.dom
+179 		 * @function
+180 		 */
+181 		hide: function ()
+182 		{
+183 			this.css('display', 'none');
+184 		},
+185 		/**
+186 		 * Shows the element(s) specified by the current selector.
+187 		 * if type is specified, the element will have it's style
+188 		 * property set to "display:[your type]". If type is not
+189 		 * specified, the element is set to "display:block".
+190 		 *
+191 		 * @name  show
+192 		 * @memberOf $_.dom
+193 		 * @function
+194 		 * @param [string] type
+195 		 */
+196 		show: function (type)
+197 		{
+198 			if (type === undefined)
+199 			{
+200 				type = "block";
+201 			}
+202 
+203 			this.css("display", type);
+204 		},
+205 		/**
+206 		 * Sets attributes on element(s) specified by the current
+207 		 * selector, or, if name is not specified, returns the
+208 		 * value of the attribute of the element specified by the
+209 		 * current selector.
+210 		 *
+211 		 * @name attr
+212 		 * @memberOf $_.dom
+213 		 * @function
+214 		 * @param string name
+215 		 * @param [string] value
+216 		 * @return string
+217 		 * @type string
+218 		 */
+219 		attr: function (name, value)
+220 		{
+221 			var sel = this.el;
+222 
+223 			//Make sure you don't try to get a bunch of elements
+224 			if (sel.length > 1 && value === undefined)
+225 			{
+226 				return null;
+227 			}
+228 			else if (sel.length > 1 && value !== undefined) //You can set a bunch, though
+229 			{
+230 				$_.each(function (e){
+231 					return _attr(e, name, value);
+232 				});
+233 			}
+234 			else //Normal behavior
 235 			{
-236 				sel.removeAttribute(name);
+236 				return _attr(sel, name, value);
 237 			}
-238 			else
-239 			{
-240 				delete sel[name];
-241 			}
-242 		}
-243 
-244 		return (typeof value !== "undefined") ? value : oldVal;
-245 	}
-246 
-247 	/**
-248 	 * Change css property name to it's
-249 	 * javascript camel case equivalent
-250 	 */
-251 	function _toCamel(s)
-252 	{
-253 		return s.replace(/(\-[a-z])/g, function($1){
-254 			return $1.toUpperCase().replace('-','');
-255 		});
-256 	}
+238 		},
+239 		/**
+240 		 * Sets or retrieves the text content of the element
+241 		 * specified by the current selector. If a value is
+242 		 * passed, it will set that value on the current element,
+243 		 * otherwise it will return the value of the current element
+244 		 *
+245 		 * @name text
+246 		 * @memberOf $_.dom
+247 		 * @function
+248 		 * @param [string] value
+249 		 * @return string
+250 		 * @type string
+251 		 */
+252 		text: function (value)
+253 		{
+254 			var oldValue, set, sel;
+255 
+256 			sel = this.el;
 257 
-258 	function _css(sel, prop, val)
-259 	{
-260 		var equi;
+258 			set = (value !== undefined) ? true : false;
+259 
+260 			oldValue = sel.textContent;
 261 
-262 		//Camel-case
-263 		prop = _toCamel(prop);
-264 
-265 		//Equivalent properties for 'special' browsers
-266 		equi = {
-267 			outerHeight: "offsetHeight",
-268 			outerWidth: "offsetWidth",
-269 			top: "posTop"
-270 		};
-271 
-272 
-273 		//If you don't define a value, try returning the existing value
-274 		if(typeof val === "undefined" && sel.style[prop] !== "undefined")
-275 		{
-276 			return sel.style[prop];
-277 		}
-278 		else if(typeof val === "undefined" && sel.style[equi[prop]] !== "undefined")
-279 		{
-280 			return sel.style[equi[prop]];
-281 		}
-282 
-283 		//Let's try the easy way first
-284 		if(typeof sel.style[prop] !== "undefined")
-285 		{
-286 			sel.style[prop] = val;
-287 
-288 			//Short circuit
-289 			return null;
-290 		}
-291 		else if(sel.style[equi[prop]])
-292 		{
-293 			sel.style[equi[prop]] = val;
-294 			return null;
-295 		}
-296 	}
-297 
-298 	// --------------------------------------------------------------------------
-299 
-300 	/**
-301 	 * DOM
-302 	 *
-303 	 * Dom manipulation module
-304 	 * @namespace
-305 	 * @memberOf $_
-306 	 * @name dom
-307 	 */
-308 	d = {
-309 		/**
-310 		 * Adds a class to the element(s) specified by the current
-311 		 * selector
-312 		 *
-313 		 * @name addClass
-314 		 * @memberOf $_.dom
-315 		 * @function
-316 		 * @param string class
-317 		 */
-318 		addClass: function (c)
-319 		{
-320 			$_.each(function (e){
-321 				e.classList.add(c);
-322 			});
-323 		},
-324 		/**
-325 		 * Removes a class from the element(s) specified by the current
-326 		 * selector
-327 		 *
-328 		 * @name removeClass
-329 		 * @memberOf $_.dom
-330 		 * @function
-331 		 * @param string class
-332 		 */
-333 		removeClass: function (c)
-334 		{
-335 			$_.each(function (e){
-336 				e.classList.remove(c);
-337 			});
-338 		},
-339 		/**
-340 		 * Hides the element(s) specified by the current selector
-341 		 *
-342 		 * @name hide
-343 		 * @memberOf $_.dom
-344 		 * @function
-345 		 */
-346 		hide: function ()
-347 		{
-348 			this.css('display', 'none');
-349 		},
-350 		/**
-351 		 * Shows the element(s) specified by the current selector.
-352 		 * if type is specified, the element will have it's style
-353 		 * property set to "display:[your type]". If type is not
-354 		 * specified, the element is set to "display:block".
-355 		 *
-356 		 * @name  show
-357 		 * @memberOf $_.dom
-358 		 * @function
-359 		 * @param [string] type
-360 		 */
-361 		show: function (type)
-362 		{
-363 			if (typeof type === "undefined")
-364 			{
-365 				type = "block";
-366 			}
-367 
-368 			this.css("display", type);
-369 		},
-370 		/**
-371 		 * Sets attributes on element(s) specified by the current
-372 		 * selector, or, if name is not specified, returns the
-373 		 * value of the attribute of the element specified by the
-374 		 * current selector.
-375 		 *
-376 		 * @name attr
-377 		 * @memberOf $_.dom
-378 		 * @function
-379 		 * @param string name
-380 		 * @param [string] value
-381 		 * @return string
-382 		 * @type string
-383 		 */
-384 		attr: function (name, value)
-385 		{
-386 			var sel = this.el;
-387 
-388 			//Make sure you don't try to get a bunch of elements
-389 			if (sel.length > 1 && typeof value === "undefined")
-390 			{
-391 				return null;
-392 			}
-393 			else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though
-394 			{
-395 				$_.each(function (e){
-396 					return _attr(e, name, value);
-397 				});
-398 			}
-399 			else //Normal behavior
-400 			{
-401 				return _attr(sel, name, value);
-402 			}
-403 		},
-404 		/**
-405 		 * Sets or retrieves the text content of the element
-406 		 * specified by the current selector. If a value is
-407 		 * passed, it will set that value on the current element,
-408 		 * otherwise it will return the value of the current element
-409 		 *
-410 		 * @name text
-411 		 * @memberOf $_.dom
-412 		 * @function
-413 		 * @param [string] value
-414 		 * @return string
-415 		 * @type string
-416 		 */
-417 		text: function (value)
-418 		{
-419 			var oldValue, set, sel;
-420 
-421 			sel = this.el;
-422 
-423 			set = (typeof value !== "undefined") ? true : false;
-424 
-425 			oldValue = sel.textContent;
-426 
-427 			if(set)
-428 			{
-429 				sel.textContent = value;
-430 				return value;
-431 			}
-432 			else
-433 			{
-434 				return oldValue;
-435 			}
-436 		},
-437 		/**
-438 		 * Sets or retrieves a css property of the element
-439 		 * specified by the current selector. If a value is
-440 		 * passed, it will set that value on the current element,
-441 		 * otherwise it will return the value of the css property
-442 		 * on the current element
-443 		 *
-444 		 * @name css
-445 		 * @memberOf $_.dom
-446 		 * @function
-447 		 * @param string property
-448 		 * @param [string] value
-449 		 * @return string
-450 		 * @type string
-451 		 */
-452 		css: function (prop, val)
-453 		{
-454 			//Return the current value if a value is not set
-455 			if(typeof val === "undefined")
-456 			{
-457 				return _css(this.el, prop);
-458 			}
-459 
-460 			$_.each(function (e){
-461 				_css(e, prop, val);
-462 			});
-463 		},
-464 		/**
-465 		 * Adds to the innerHTML of the current element, after the last child.
-466 		 *
-467 		 * @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
-468 		 * @name append
-469 		 * @memberOf $_.dom
-470 		 * @function
-471 		 * @param string htm
-472 		 */
-473 		append: function(htm)
-474 		{
-475 			if(typeof document.insertAdjacentHTML !== "undefined")
-476 			{
-477 				this.el.insertAdjacentHTML('beforeend', htm);
-478 			}
-479 			else
-480 			{
-481 				this.el.innerHTML += htm;
-482 			}
-483 		},
-484 		/**
-485 		 * Adds to the innerHTML of the selected element, before the current children
-486 		 *
-487 		 * @name prepend
-488 		 * @memberOf $_.dom
-489 		 * @function
-490 		 * @param string htm
-491 		 */
-492 		 prepend: function(htm)
-493 		 {
-494 		 	if(typeof document.insertAdjacentHTML !== "undefined")
-495 		 	{
-496 		 		this.el.insertAdjacentHTML('afterbegin', htm);
-497 		 	}
-498 		 	else
-499 		 	{
-500 		 		this.el.innerHTML = htm + this.el.innerHTML;
-501 		 	}
-502 		 },
-503 		/**
-504 		 * Sets or gets the innerHTML propery of the element(s) passed
-505 		 *
-506 		 * @name html
-507 		 * @memberOf $_.dom
-508 		 * @function
-509 		 * @param [string] htm
-510 		 * @return string
-511 		 * @type string
-512 		 */
-513 		html: function(htm)
-514 		{
-515 
-516 			if(typeof htm !== "undefined")
-517 			{
-518 				this.el.innerHTML = htm;
-519 			}
-520 
-521 			//If the parameter is undefined, just return the current value
-522 			return this.el.innerHTML;
-523 		}
-524 	};
-525 
-526 	$_.ext('dom', d);
-527 
-528 }());
\ No newline at end of file +262
if(set) +263 { +264 sel.textContent = value; +265 return value; +266 } +267 else +268 { +269 return oldValue; +270 } +271 }, +272 /** +273 * Sets or retrieves a css property of the element +274 * specified by the current selector. If a value is +275 * passed, it will set that value on the current element, +276 * otherwise it will return the value of the css property +277 * on the current element +278 * +279 * @name css +280 * @memberOf $_.dom +281 * @function +282 * @param string property +283 * @param [string] value +284 * @return string +285 * @type string +286 */ +287 css: function (prop, val) +288 { +289 //Return the current value if a value is not set +290 if(val === undefined) +291 { +292 return _css(this.el, prop); +293 } +294 +295 $_.each(function (e){ +296 _css(e, prop, val); +297 }); +298 }, +299 /** +300 * Adds to the innerHTML of the current element, after the last child. +301 * +302 * @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element +303 * @name append +304 * @memberOf $_.dom +305 * @function +306 * @param string htm +307 */ +308 append: function(htm) +309 { +310 if(document.insertAdjacentHTML !== undefined) +311 { +312 this.el.insertAdjacentHTML('beforeend', htm); +313 } +314 else +315 { +316 this.el.innerHTML += htm; +317 } +318 }, +319 /** +320 * Adds to the innerHTML of the selected element, before the current children +321 * +322 * @name prepend +323 * @memberOf $_.dom +324 * @function +325 * @param string htm +326 */ +327 prepend: function(htm) +328 { +329 if(document.insertAdjacentHTML !== undefined) +330 { +331 this.el.insertAdjacentHTML('afterbegin', htm); +332 } +333 else +334 { +335 this.el.innerHTML = htm + this.el.innerHTML; +336 } +337 }, +338 /** +339 * Sets or gets the innerHTML propery of the element(s) passed +340 * +341 * @name html +342 * @memberOf $_.dom +343 * @function +344 * @param [string] htm +345 * @return string +346 * @type string +347 */ +348 html: function(htm) +349 { +350 +351 if(htm !== undefined) +352 { +353 this.el.innerHTML = htm; +354 } +355 +356 //If the parameter is undefined, just return the current value +357 return this.el.innerHTML; +358 } +359 }; +360 +361 $_.ext('dom', d); +362 +363 }()); \ No newline at end of file diff --git a/docs/symbols/src/kis-js_src_modules_ajax.js.html b/docs/symbols/src/kis-js_src_modules_ajax.js.html index 3890122..979974e 100755 --- a/docs/symbols/src/kis-js_src_modules_ajax.js.html +++ b/docs/symbols/src/kis-js_src_modules_ajax.js.html @@ -10,12 +10,12 @@ 3 * 4 * Module for making ajax requests 5 */ - 6 (function (){ + 6 (function (undefined){ 7 8 "use strict"; 9 10 // Don't bother even defining the object if the XMLHttpRequest isn't available - 11 if(typeof window.XMLHttpRequest === "undefined") + 11 if(window.XMLHttpRequest === undefined) 12 { 13 return; 14 } @@ -26,7 +26,7 @@ 19 var type, 20 request = new XMLHttpRequest(); 21 - 22 if (typeof success_callback === "undefined") + 22 if (success_callback === undefined) 23 { 24 /** 25 * @private @@ -55,7 +55,7 @@ 48 } 49 else 50 { - 51 if (typeof error_callback !== 'undefined') + 51 if (error_callback !== undefined) 52 { 53 error_callback.call(request.status, request.status); 54 } @@ -147,7 +147,7 @@ 140 var source; 141 142 // Check for server-sent event support -143 if (typeof EventSource !== 'undefined') +143 if (EventSource !== undefined) 144 { 145 source = new EventSource(url); 146 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 dece4c5..558202e 100755 --- a/docs/symbols/src/kis-js_src_modules_event.js.html +++ b/docs/symbols/src/kis-js_src_modules_event.js.html @@ -11,14 +11,14 @@ 4 * Event api wrapper 5 * @todo Add method for triggering events 6 */ - 7 (function (){ + 7 (function (undefined){ 8 9 "use strict"; 10 11 var _add_remove, e, _attach_delegate; 12 13 // Don't bother defining the methods if event api isn't supports - 14 if (typeof document.addEventListener === "undefined") + 14 if (document.addEventListener === undefined) 15 { 16 return false; 17 } @@ -27,7 +27,7 @@ 20 { 21 var i, len; 22 - 23 if(typeof sel === "undefined") + 23 if(sel === undefined) 24 { 25 return null; 26 } diff --git a/docs/symbols/src/kis-js_src_modules_store.js.html b/docs/symbols/src/kis-js_src_modules_store.js.html index 1a97edf..42a1b95 100755 --- a/docs/symbols/src/kis-js_src_modules_store.js.html +++ b/docs/symbols/src/kis-js_src_modules_store.js.html @@ -10,12 +10,12 @@ 3 * 4 * Wrapper for local / sessionstorage 5 */ - 6 (function (){ + 6 (function (undefined){ 7 8 "use strict"; 9 10 //No support for localstorage? Bail out early - 11 if(typeof localStorage === "undefined" || typeof JSON === "undefined") + 11 if(localStorage === undefined || JSON === undefined) 12 { 13 return null; 14 } diff --git a/docs/symbols/src/kis-js_src_modules_util.js.html b/docs/symbols/src/kis-js_src_modules_util.js.html index b79f0b5..e9126d4 100755 --- a/docs/symbols/src/kis-js_src_modules_util.js.html +++ b/docs/symbols/src/kis-js_src_modules_util.js.html @@ -11,7 +11,7 @@ 4 * Various object and string manipulation functions 5 * Note: these are based on similar phpjs functions: http://phpjs.org 6 */ - 7 (function (){ + 7 (function (undefined){ 8 9 "use strict"; 10 diff --git a/kis-all.js b/kis-all.js index 3733220..7372ba4 100755 --- a/kis-all.js +++ b/kis-all.js @@ -2,9 +2,9 @@ Kis JS Keep It Simple JS Library Copyright Timothy J. Warren License Public Domain - Version 0.7.0 + Version 0.8.0 */ -(function (){ +(function (undefined){ "use strict"; @@ -14,7 +14,7 @@ // selector engine. I choose to just use the // browser feature, since it is present in // IE 8+, and all other major browsers - if (typeof document.querySelector === "undefined") + if (document.querySelector === undefined) { return; } @@ -35,10 +35,10 @@ $_ = function(s) { // Have documentElement be default selector, just in case - if (typeof s === "undefined") + if (s === undefined) { // Defines a "global" selector for that instance - sel = (typeof $_.el !== "undefined") + sel = ($_.el !== undefined) ? $_.el : document.documentElement; } @@ -80,7 +80,7 @@ { var x, c; - if (typeof a != "string" || typeof a === "undefined"){ return a;} + if (typeof a != "string" || a === undefined){ return a;} //Check for a context of a specific element, otherwise, just run on the document c = (context != null && context.nodeType === 1) @@ -113,12 +113,12 @@ { var type, F; - if(typeof obj === "undefined") + if(obj === undefined) { return; } - if(typeof Object.create !== "undefined") + if(Object.create !== undefined) { return Object.create(obj); } @@ -162,10 +162,10 @@ */ $_.ext('each', function (callback) { - if(typeof sel.length !== "undefined" && sel !== window) + if(sel.length !== undefined && sel !== window) { // Use the native method, if it exists - if(typeof Array.prototype.forEach !== 'undefined') + if(Array.prototype.forEach !== undefined) { [].forEach.call(sel, callback); return; @@ -255,177 +255,15 @@ if (typeof Array.isArray === "undefined") // -------------------------------------------------------------------------- -(function ($_){ +(function ($_, undefined){ "use strict" // -------------------------------------------------------------------------- //This is used so IE can use the classList api -/* - * classList.js: Cross-browser full element.classList implementation. - * 2011-06-15 - * - * By Eli Grey, http://eligrey.com - * Public Domain. - * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - */ -if (typeof document !== "undefined" && !("classList" in document.createElement("a"))) -{ - (function (view){ - - var classListProp = "classList", - protoProp = "prototype", - elemCtrProto = (view.HTMLElement || view.Element)[protoProp], - objCtr = Object, - strTrim = String[protoProp].trim || - function () - { - return this.replace(/^\s+|\s+$/g, ""); - }, - arrIndexOf = Array[protoProp].indexOf || - function (item) - { - var - i = 0, - len = this.length; - for (; i < len; i++) - { - if (i in this && this[i] === item) - { - return i; - } - } - return -1; - } - // Vendors: please allow content code to instantiate DOMExceptions - , - /** - * @private - */ - DOMEx = function (type, message) - { - this.name = type; - this.code = DOMException[type]; - this.message = message; - }, - /** - * @private - */ - checkTokenAndGetIndex = function (classList, token) - { - if (token === "") - { - throw new DOMEx("SYNTAX_ERR", "An invalid or illegal string was specified"); - } - if (/\s/.test(token)) - { - throw new DOMEx("INVALID_CHARACTER_ERR", "String contains an invalid character"); - } - return arrIndexOf.call(classList, token); - }, - /** - * @private - */ - ClassList = function (elem) - { - var - trimmedClasses = strTrim.call(elem.className), - classes = trimmedClasses ? trimmedClasses.split(/\s+/) : [], - i = 0, - len = classes.length; - for (; i < len; i++) - { - this.push(classes[i]); - } - this._updateClassName = function () - { - elem.className = this.toString(); - }; - }, - classListProto = ClassList[protoProp] = [], - /** - * @private - */ - classListGetter = function () - { - return new ClassList(this); - }; - // Most DOMException implementations don't allow calling DOMException's toString() - // on non-DOMExceptions. Error's toString() is sufficient here. - DOMEx[protoProp] = Error[protoProp]; - classListProto.item = function (i) - { - return this[i] || null; - }; - classListProto.contains = function (token) - { - token += ""; - return checkTokenAndGetIndex(this, token) !== -1; - }; - classListProto.add = function (token) - { - token += ""; - if (checkTokenAndGetIndex(this, token) === -1) - { - this.push(token); - this._updateClassName(); - } - }; - classListProto.remove = function (token) - { - token += ""; - var index = checkTokenAndGetIndex(this, token); - if (index !== -1) - { - this.splice(index, 1); - this._updateClassName(); - } - }; - classListProto.toggle = function (token) - { - token += ""; - if (checkTokenAndGetIndex(this, token) === -1) - { - this.add(token); - } - else - { - this.remove(token); - } - }; - classListProto.toString = function () - { - return this.join(" "); - }; - - if (objCtr.defineProperty) - { - var classListPropDesc = { - get: classListGetter, - enumerable: true, - configurable: true - }; - try - { - objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); - } - catch (ex) - { // IE 8 doesn't support enumerable:true - if (ex.number === -0x7FF5EC54) - { - classListPropDesc.enumerable = false; - objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); - } - } - } - else if (objCtr[protoProp].__defineGetter__) - { - elemCtrProto.__defineGetter__(classListProp, classListGetter); - } - - }(self)); -} +/*! @source http://purl.eligrey.com/github/classList.js/blob/master/classList.js*/ +if(typeof document!=="undefined"&&!("classList" in document.createElement("a"))){(function(j){if(!("HTMLElement" in j)&&!("Element" in j)){return}var a="classList",f="prototype",m=(j.HTMLElement||j.Element)[f],b=Object,k=String[f].trim||function(){return this.replace(/^\s+|\s+$/g,"")},c=Array[f].indexOf||function(q){var p=0,o=this.length;for(;p 1 && typeof value === "undefined") + if (sel.length > 1 && value === undefined) { return null; } - else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though + else if (sel.length > 1 && value !== undefined) //You can set a bunch, though { $_.each(function (e){ return _attr(e, name, value); @@ -681,7 +516,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" sel = this.el; - set = (typeof value !== "undefined") ? true : false; + set = (value !== undefined) ? true : false; oldValue = sel.textContent; @@ -713,7 +548,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" css: function (prop, val) { //Return the current value if a value is not set - if(typeof val === "undefined") + if(val === undefined) { return _css(this.el, prop); } @@ -733,7 +568,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" */ append: function(htm) { - if(typeof document.insertAdjacentHTML !== "undefined") + if(document.insertAdjacentHTML !== undefined) { this.el.insertAdjacentHTML('beforeend', htm); } @@ -752,7 +587,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" */ prepend: function(htm) { - if(typeof document.insertAdjacentHTML !== "undefined") + if(document.insertAdjacentHTML !== undefined) { this.el.insertAdjacentHTML('afterbegin', htm); } @@ -774,7 +609,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" html: function(htm) { - if(typeof htm !== "undefined") + if(htm !== undefined) { this.el.innerHTML = htm; } @@ -798,7 +633,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" // Don't bother even defining the object if the XMLHttpRequest isn't available - if(typeof window.XMLHttpRequest === "undefined") + if(window.XMLHttpRequest === undefined) { return; } @@ -809,7 +644,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" var type, request = new XMLHttpRequest(); - if (typeof success_callback === "undefined") + if (success_callback === undefined) { /** * @private @@ -838,7 +673,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" } else { - if (typeof error_callback !== 'undefined') + if (error_callback !== undefined) { error_callback.call(request.status, request.status); } @@ -930,7 +765,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" var source; // Check for server-sent event support - if (typeof EventSource !== 'undefined') + if (EventSource !== undefined) { source = new EventSource(url); @@ -956,7 +791,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" var _add_remove, e, _attach_delegate; // Don't bother defining the methods if event api isn't supports - if (typeof document.addEventListener === "undefined") + if (document.addEventListener === undefined) { return false; } @@ -965,7 +800,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" { var i, len; - if(typeof sel === "undefined") + if(sel === undefined) { return null; } @@ -1109,7 +944,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" //No support for localstorage? Bail out early - if(typeof localStorage === "undefined" || typeof JSON === "undefined") + if(localStorage === undefined || JSON === undefined) { return null; } diff --git a/kis-lite-dom-min.js b/kis-lite-dom-min.js index 758a12a..f377dc0 100755 --- a/kis-lite-dom-min.js +++ b/kis-lite-dom-min.js @@ -1,14 +1,15 @@ -(function(){if("undefined"!==typeof document.querySelector){var d,f,a,b;d=function(c){b="undefined"===typeof c?"undefined"!==typeof d.el?d.el:document.documentElement:f(c);d.prototype.el=b;var c=a(d),g;for(g in c)"object"===typeof c[g]&&(c[g].el=b);c.el=b;return c};f=function(c,b){var a;if("string"!=typeof c||"undefined"===typeof c)return c;a=null!=b&&1===b.nodeType?b:document;if(c.match(/^#([\w\-]+$)/))return document.getElementById(c.split("#")[1]);a=a.querySelectorAll(c);return 1===a.length?a[0]: -a};a=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}};d.ext=function(a,g){g.el=b;d[a]=g};d.ext("each",function(a){if("undefined"!==typeof b.length&&b!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(b,a);else{var g=b.length;if(0!==g)for(var e,d=0;d 1 && typeof value === "undefined") + if (sel.length > 1 && value === undefined) { return null; } - else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though + else if (sel.length > 1 && value !== undefined) //You can set a bunch, though { $_.each(function (e){ return _attr(e, name, value); @@ -990,7 +825,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" sel = this.el; - set = (typeof value !== "undefined") ? true : false; + set = (value !== undefined) ? true : false; oldValue = sel.textContent; @@ -1022,7 +857,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" css: function (prop, val) { //Return the current value if a value is not set - if(typeof val === "undefined") + if(val === undefined) { return _css(this.el, prop); } @@ -1042,7 +877,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" */ append: function(htm) { - if(typeof document.insertAdjacentHTML !== "undefined") + if(document.insertAdjacentHTML !== undefined) { this.el.insertAdjacentHTML('beforeend', htm); } @@ -1061,7 +896,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" */ prepend: function(htm) { - if(typeof document.insertAdjacentHTML !== "undefined") + if(document.insertAdjacentHTML !== undefined) { this.el.insertAdjacentHTML('afterbegin', htm); } @@ -1083,7 +918,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" html: function(htm) { - if(typeof htm !== "undefined") + if(htm !== undefined) { this.el.innerHTML = htm; } diff --git a/kis-lite-min.js b/kis-lite-min.js index bb1c6b1..12f57f1 100755 --- a/kis-lite-min.js +++ b/kis-lite-min.js @@ -1,7 +1,7 @@ -(function(){if("undefined"!==typeof document.querySelector){var d,f,c,a;d=function(b){a="undefined"===typeof b?"undefined"!==typeof d.el?d.el:document.documentElement:f(b);d.prototype.el=a;var b=c(d),g;for(g in b)"object"===typeof b[g]&&(b[g].el=a);b.el=a;return b};f=function(b,a){var c;if("string"!=typeof b||"undefined"===typeof b)return b;c=null!=a&&1===a.nodeType?a:document;if(b.match(/^#([\w\-]+$)/))return document.getElementById(b.split("#")[1]);c=c.querySelectorAll(b);return 1===c.length?c[0]: -c};c=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}};d.ext=function(b,c){c.el=a;d[b]=c};d.ext("each",function(b){if("undefined"!==typeof a.length&&a!==window)if("undefined"!==typeof Array.prototype.forEach)[].forEach.call(a,b);else{var c=a.length;if(0!==c)for(var e,d=0;dd?1:ca?1:bd?1:ca?1:b 1 && typeof value === "undefined") + if (sel.length > 1 && value === undefined) { return null; } - else if (sel.length > 1 && typeof value !== "undefined") //You can set a bunch, though + else if (sel.length > 1 && value !== undefined) //You can set a bunch, though { $_.each(function (e){ return _attr(e, name, value); @@ -420,7 +255,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" sel = this.el; - set = (typeof value !== "undefined") ? true : false; + set = (value !== undefined) ? true : false; oldValue = sel.textContent; @@ -452,7 +287,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" css: function (prop, val) { //Return the current value if a value is not set - if(typeof val === "undefined") + if(val === undefined) { return _css(this.el, prop); } @@ -472,7 +307,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" */ append: function(htm) { - if(typeof document.insertAdjacentHTML !== "undefined") + if(document.insertAdjacentHTML !== undefined) { this.el.insertAdjacentHTML('beforeend', htm); } @@ -491,7 +326,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" */ prepend: function(htm) { - if(typeof document.insertAdjacentHTML !== "undefined") + if(document.insertAdjacentHTML !== undefined) { this.el.insertAdjacentHTML('afterbegin', htm); } @@ -513,7 +348,7 @@ if (typeof document !== "undefined" && !("classList" in document.createElement(" html: function(htm) { - if(typeof htm !== "undefined") + if(htm !== undefined) { this.el.innerHTML = htm; } diff --git a/src/modules/ajax.js b/src/modules/ajax.js old mode 100644 new mode 100755 index 1ba09b5..be88386 --- a/src/modules/ajax.js +++ b/src/modules/ajax.js @@ -3,12 +3,12 @@ * * Module for making ajax requests */ -(function (){ +(function (undefined){ "use strict"; // Don't bother even defining the object if the XMLHttpRequest isn't available - if(typeof window.XMLHttpRequest === "undefined") + if(window.XMLHttpRequest === undefined) { return; } @@ -19,7 +19,7 @@ var type, request = new XMLHttpRequest(); - if (typeof success_callback === "undefined") + if (success_callback === undefined) { /** * @private @@ -48,7 +48,7 @@ } else { - if (typeof error_callback !== 'undefined') + if (error_callback !== undefined) { error_callback.call(request.status, request.status); } @@ -140,7 +140,7 @@ var source; // Check for server-sent event support - if (typeof EventSource !== 'undefined') + if (EventSource !== undefined) { source = new EventSource(url); diff --git a/src/modules/event.js b/src/modules/event.js old mode 100644 new mode 100755 index 5c35799..1c29a9b --- a/src/modules/event.js +++ b/src/modules/event.js @@ -4,14 +4,14 @@ * Event api wrapper * @todo Add method for triggering events */ -(function (){ +(function (undefined){ "use strict"; var _add_remove, e, _attach_delegate; // Don't bother defining the methods if event api isn't supports - if (typeof document.addEventListener === "undefined") + if (document.addEventListener === undefined) { return false; } @@ -20,7 +20,7 @@ { var i, len; - if(typeof sel === "undefined") + if(sel === undefined) { return null; } diff --git a/src/modules/store.js b/src/modules/store.js index d1e9bd2..1682fbf 100755 --- a/src/modules/store.js +++ b/src/modules/store.js @@ -3,12 +3,12 @@ * * Wrapper for local / sessionstorage */ -(function (){ +(function (undefined){ "use strict"; //No support for localstorage? Bail out early - if(typeof localStorage === "undefined" || typeof JSON === "undefined") + if(localStorage === undefined || JSON === undefined) { return null; } diff --git a/src/modules/util.js b/src/modules/util.js old mode 100644 new mode 100755 index 49e0f03..4269266 --- a/src/modules/util.js +++ b/src/modules/util.js @@ -4,7 +4,7 @@ * Various object and string manipulation functions * Note: these are based on similar phpjs functions: http://phpjs.org */ -(function (){ +(function (undefined){ "use strict";