From 6d990b65bb8ce24c4fa7dad22887c3b8660115a5 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 6 Dec 2011 11:47:22 -0500 Subject: [PATCH] Misc updates --- combine.php | 4 +- .../src/kis-js_src_modules_DOM.js.html | 96 +++++++++++-------- kis-all.js | 18 +++- kis-min.js | 6 +- tests/index.html | 1 + tests/tests/template.js | 8 ++ 6 files changed, 85 insertions(+), 48 deletions(-) create mode 100644 tests/tests/template.js diff --git a/combine.php b/combine.php index 16d5366..f77589b 100755 --- a/combine.php +++ b/combine.php @@ -52,14 +52,14 @@ foreach($files as $f) file_put_contents("kis-custom.js", $new_file); //Get a much-minified version from Google's closure compiler -/*$ch = curl_init('http://closure-compiler.appspot.com/compile'); +$ch = curl_init('http://closure-compiler.appspot.com/compile'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, 'output_info=compiled_code&output_format=text&compilation_level=SIMPLE_OPTIMIZATIONS&js_code=' . urlencode($new_file)); $output = curl_exec($ch); curl_close($ch); -file_put_contents("kis-custom-min.js", $output);*/ +file_put_contents("kis-custom-min.js", $output); //Display the output on-screen too 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 05d7980..0c1265e 100644 --- a/docs/symbols/src/kis-js_src_modules_DOM.js.html +++ b/docs/symbols/src/kis-js_src_modules_DOM.js.html @@ -320,44 +320,58 @@ 313 */ 314 append: function(htm) 315 { -316 this.el.insertAdjacentHTML('beforeend', htm); -317 }, -318 /** -319 * Adds to the innerHTML of the selected element, before the current children -320 * -321 * @name prepend -322 * @memberOf $_.dom -323 * @function -324 * @param string htm -325 */ -326 prepend: function(htm) -327 { -328 this.el.insertAdjacentHTML('afterbegin', htm); -329 }, -330 /** -331 * Sets or gets the innerHTML propery of the element(s) passed -332 * -333 * @name html -334 * @memberOf $_.dom -335 * @function -336 * @param [string] htm -337 * @return string -338 * @type string -339 */ -340 html: function(htm) -341 { -342 -343 if(typeof htm !== "undefined") -344 { -345 this.el.innerHTML = htm; -346 } -347 -348 //If the parameter is undefined, just return the current value -349 return this.el.innerHTML; -350 } -351 }; -352 -353 $_.ext('dom', d); -354 -355 }()); -356 \ No newline at end of file +316 if(typeof document.insertAdjacentHTML !== "undefined") +317 { +318 this.el.insertAdjacentHTML('beforeend', htm); +319 } +320 else +321 { +322 this.el.innerHTML += htm; +323 } +324 }, +325 /** +326 * Adds to the innerHTML of the selected element, before the current children +327 * +328 * @name prepend +329 * @memberOf $_.dom +330 * @function +331 * @param string htm +332 */ +333 prepend: function(htm) +334 { +335 if(typeof document.insertAdjacentHTML !== "undefined") +336 { +337 this.el.insertAdjacentHTML('afterbegin', htm); +338 } +339 else +340 { +341 this.el.innerHTML = htm + this.el.innerHTML; +342 } +343 }, +344 /** +345 * Sets or gets the innerHTML propery of the element(s) passed +346 * +347 * @name html +348 * @memberOf $_.dom +349 * @function +350 * @param [string] htm +351 * @return string +352 * @type string +353 */ +354 html: function(htm) +355 { +356 +357 if(typeof htm !== "undefined") +358 { +359 this.el.innerHTML = htm; +360 } +361 +362 //If the parameter is undefined, just return the current value +363 return this.el.innerHTML; +364 } +365 }; +366 +367 $_.ext('dom', d); +368 +369 }()); +370 \ No newline at end of file diff --git a/kis-all.js b/kis-all.js index 048428d..2e7db7b 100755 --- a/kis-all.js +++ b/kis-all.js @@ -749,7 +749,14 @@ */ append: function(htm) { - this.el.insertAdjacentHTML('beforeend', htm); + if(typeof document.insertAdjacentHTML !== "undefined") + { + this.el.insertAdjacentHTML('beforeend', htm); + } + else + { + this.el.innerHTML += htm; + } }, /** * Adds to the innerHTML of the selected element, before the current children @@ -761,7 +768,14 @@ */ prepend: function(htm) { - this.el.insertAdjacentHTML('afterbegin', htm); + if(typeof document.insertAdjacentHTML !== "undefined") + { + this.el.insertAdjacentHTML('afterbegin', htm); + } + else + { + this.el.innerHTML = htm + this.el.innerHTML; + } }, /** * Sets or gets the innerHTML propery of the element(s) passed diff --git a/kis-min.js b/kis-min.js index 6c43246..1058519 100755 --- a/kis-min.js +++ b/kis-min.js @@ -8,8 +8,8 @@ h=function(){return new e(this)};a.prototype=Error.prototype;j.item=function(a){ (function(){function g(b,a,c){var e,d;if("undefined"!==typeof b.hasAttribute)b.hasAttribute(a)&&(e=b.getAttribute(a)),d=!0;else if("undefined"!==typeof b[a])e=b[a],d=!1;else if("class"===a&&"undefined"!==typeof b.className)a="className",e=b.className,d=!1;if("undefined"===typeof e&&("undefined"===typeof c||null===c))console.log(c),console.log(b),console.log("Element does not have the selected attribute");else{if("undefined"===typeof c)return e;"undefined"!==typeof c&&null!==c?!0===d?b.setAttribute(a, c):b[a]=c:null===c&&(!0===d?b.removeAttribute(a):delete b[a]);return"undefined"!==typeof c?c:e}}function f(b){return b.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function d(b,a,c){var e,a=f(a);e={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if("undefined"===typeof c&&"undefined"!==b.style[a])return b.style[a];if("undefined"===typeof c&&"undefined"!==b.style[e[a]])return b.style[e[a]];"undefined"!==typeof b.style[a]?b.style[a]=c:b.style[e[a]]?b.style[e[a]]= c:console.log("Property "+a+" nor an equivalent seems to exist")}$_.ext("dom",{addClass:function(b){$_.each(function(a){a.classList.add(b)})},removeClass:function(b){$_.each(function(a){a.classList.remove(b)})},hide:function(){this.css("display","none")},show:function(b){"undefined"===typeof b&&(b="block");this.css("display",b)},attr:function(b,a){var c=this.el;if(1\s+<"),a=a.replace(/>\s+\{/gim,">{"),a=a.replace(/\}\s+ + \ No newline at end of file diff --git a/tests/tests/template.js b/tests/tests/template.js new file mode 100644 index 0000000..bc7c591 --- /dev/null +++ b/tests/tests/template.js @@ -0,0 +1,8 @@ +(function(){ + "use strict"; + + module("template"); + + + +}()); \ No newline at end of file