Fixed broken tests

This commit is contained in:
Timothy Warren 2012-02-08 11:54:46 -05:00
parent 6b2fab7b46
commit 1a8addc49c
7 changed files with 756 additions and 738 deletions

View File

@ -12,59 +12,61 @@
<span class='line'> 5</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 5</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 6</span> </span><span class="WHIT"> <span class='line'> 6</span> </span><span class="WHIT">
<span class='line'> 7</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">db</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.indexedDB</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">window.webkitIndexedDB</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">window.mozIndexedDB</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">window.msIndexedDB</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'> 7</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">db</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window.indexedDB</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">window.webkitIndexedDB</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">window.mozIndexedDB</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">window.msIndexedDB</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 8</span> </span><span class="WHIT"> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 8</span> </span><span class="WHIT"> </span><span class="NAME">indexedDB</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 9</span> </span><span class="WHIT"> </span><span class="NAME">indexedDB</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 9</span>
<span class='line'> 10</span> </span><span class="WHIT"> <span class='line'> 10</span> </span><span class="WHIT"> </span><span class="COMM">/**
<span class='line'> 11</span> </span><span class="COMM">/** <span class='line'> 11</span> * Module for simplifying Indexed DB access
<span class='line'> 12</span> * @private <span class='line'> 12</span> *
<span class='line'> 13</span> */</span><span class="WHIT"> <span class='line'> 13</span> * @namespace
<span class='line'> 14</span> </span><span class="NAME">request.onerror</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> <span class='line'> 14</span> * @name indexedDB
<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'> 15</span> * @memberOf $_
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"IndexedDB disallowed."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 16</span> */</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">indexedDB</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 18</span> </span><span class="WHIT"> <span class='line'> 18</span> </span><span class="WHIT"> </span><span class="NAME">current_db</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 19</span> </span><span class="COMM">/** <span class='line'> 19</span> </span><span class="WHIT"> </span><span class="COMM">/**
<span class='line'> 20</span> * @private <span class='line'> 20</span> * Connects to an indexedDB database
<span class='line'> 21</span> */</span><span class="WHIT"> <span class='line'> 21</span> *
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="NAME">request.onsuccess</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> <span class='line'> 22</span> * @memberOf $_.indexedDB
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'> 23</span> * @name connect
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="COMM">// Connect to the specified db</span><span class="WHIT"> <span class='line'> 24</span> * @function
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="NAME">indexedDB.current_db</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">request.result</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 25</span> * @param string dbname
<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 26</span> * @param [int] version
<span class='line'> 27</span> <span class='line'> 27</span> * @param [function] onupgradeneeded
<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="COMM">/** <span class='line'> 28</span> */</span><span class="WHIT">
<span class='line'> 29</span> * Module for simplifying Indexed DB access <span class='line'> 29</span> </span><span class="WHIT"> </span><span class="NAME">connect</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dbname</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">version</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">onupgradeneeded</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 30</span> * <span class='line'> 30</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 31</span> * @namespace <span class='line'> 31</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 32</span> * @name indexedDB <span class='line'> 32</span> </span><span class="WHIT">
<span class='line'> 33</span> * @memberOf $_ <span class='line'> 33</span> </span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 34</span> */</span><span class="WHIT"> <span class='line'> 34</span> </span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="NAME">indexedDB</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'> 35</span> </span><span class="COMM">// Ask for permission to use db</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="NAME">current_db</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'> 36</span> </span><span class="WHIT"> </span><span class="NAME">request</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">db.open</span><span class="PUNC">(</span><span class="NAME">dbname</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">version</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="COMM">/** <span class='line'> 37</span> </span><span class="WHIT">
<span class='line'> 38</span> * Connects to an indexedDB database <span class='line'> 38</span> </span><span class="COMM">// Assign onupgradeneeded callback</span><span class="WHIT">
<span class='line'> 39</span> * <span class='line'> 39</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">onupgradeneeded</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 40</span> * @memberOf $_.indexedDB <span class='line'> 40</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 41</span> * @name connect <span class='line'> 41</span> </span><span class="WHIT"> </span><span class="NAME">request.onupgradeneeded</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">onupgradeneeded</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 42</span> * @function <span class='line'> 42</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 43</span> * @param string dbname <span class='line'> 43</span> </span><span class="WHIT">
<span class='line'> 44</span> * @param [int] version <span class='line'> 44</span> </span><span class="COMM">/**
<span class='line'> 45</span> * @param [function] onupgradeneeded <span class='line'> 45</span> * @private
<span class='line'> 46</span> */</span><span class="WHIT"> <span class='line'> 46</span> */</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="NAME">connect</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">dbname</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">version</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">onupgradeneeded</span><span class="PUNC">)</span><span class="WHIT"> <span class='line'> 47</span> </span><span class="NAME">request.onerror</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'> 48</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">version</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 49</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"IndexedDB disallowed."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT"> <span class='line'> 50</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">onupgradeneeded</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> <span class='line'> 51</span> </span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'> 52</span> </span><span class="COMM">/**
<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="NAME">request.onupgradeneeded</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">onupgradeneeded</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 53</span> * @private
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'> 54</span> */</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT"> <span class='line'> 55</span> </span><span class="WHIT"> </span><span class="NAME">request.onsuccess</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="COMM">// Ask for permission to use db</span><span class="WHIT"> <span class='line'> 56</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="NAME">this.current_db</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">db.open</span><span class="PUNC">(</span><span class="NAME">dbname</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">version</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 57</span> </span><span class="WHIT"> </span><span class="COMM">// Connect to the specified db</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'> 58</span> </span><span class="WHIT"> </span><span class="NAME">indexedDB.current_db</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">request.result</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 59</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT"> <span class='line'> 60</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'indexedDB'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">indexedDB</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'> 61</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT"> <span class='line'> 62</span> </span><span class="WHIT">
<span class='line'> 63</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html> <span class='line'> 63</span> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'indexedDB'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">indexedDB</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">
<span class='line'> 65</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>

1286
kis-all.js

File diff suppressed because it is too large Load Diff

15
kis-min.js vendored
View File

@ -10,16 +10,17 @@ c:null===c&&(!0===d?b.removeAttribute(a):delete b[a]);return"undefined"!==typeof
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<c.length&&"undefined"===typeof a)console.log(c),console.log("Must be a singular element");else if(1<c.length&&"undefined"!==typeof a)$_.each(function(c){return g(c, 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<c.length&&"undefined"===typeof a)console.log(c),console.log("Must be a singular element");else if(1<c.length&&"undefined"!==typeof a)$_.each(function(c){return g(c,
b,a)});else return g(c,b,a)},text:function(b){var a,c,e;e=this.el;c="undefined"!==typeof e.innerText?"innerText":"undefined"!==typeof e.textContent?"textContent":"innerHTML";a=e[c];return"undefined"!==typeof b?e[c]=b:a},css:function(b,a){if("undefined"===typeof a)return d(this.el,b);$_.each(function(c){d(c,b,a)})},append:function(b){"undefined"!==typeof document.insertAdjacentHTML?this.el.insertAdjacentHTML("beforeend",b):this.el.innerHTML+=b},prepend:function(b){"undefined"!==typeof document.insertAdjacentHTML? b,a)});else return g(c,b,a)},text:function(b){var a,c,e;e=this.el;c="undefined"!==typeof e.innerText?"innerText":"undefined"!==typeof e.textContent?"textContent":"innerHTML";a=e[c];return"undefined"!==typeof b?e[c]=b:a},css:function(b,a){if("undefined"===typeof a)return d(this.el,b);$_.each(function(c){d(c,b,a)})},append:function(b){"undefined"!==typeof document.insertAdjacentHTML?this.el.insertAdjacentHTML("beforeend",b):this.el.innerHTML+=b},prepend:function(b){"undefined"!==typeof document.insertAdjacentHTML?
this.el.insertAdjacentHTML("afterbegin",b):this.el.innerHTML=b+this.el.innerHTML},html:function(b){"undefined"!==typeof b&&(this.el.innerHTML=b);return this.el.innerHTML}})})(); this.el.insertAdjacentHTML("afterbegin",b):this.el.innerHTML=b+this.el.innerHTML},html:function(b){"undefined"!==typeof b&&(this.el.innerHTML=b);return this.el.innerHTML}})})();
(function(){if(!("undefined"===typeof localStorage||"undefined"===typeof JSON)){var g=localStorage,f=sessionStorage;$_.ext("store",{get:function(d,b){var a=b?f.getItem(d):g.getItem(d);return JSON.parse(a)},set:function(d,b,a){b=JSON.stringify(b);a?f.setItem(d,b):g.setItem(d,b)},remove:function(d,b){b?f.removeItem(d):g.removeItem(d)},getAll:function(d){var b,a={},c,e;e=d?g:f;b=e.length;for(d=0;d<b;d++)c=e.key(d),a[c]=e.getItem(c);return a},clear:function(d){d?f.clear():g.clear()}})}})();
(function(){if("undefined"!==typeof window.XMLHttpRequest){var g={_do:function(f,d,b,a){var c=new XMLHttpRequest;"undefined"===typeof b&&(b=function(){});a=a?"POST":"GET";f+="GET"===a?"?"+this._serialize(d):"";c.open(a,f);c.onreadystatechange=function(){4===c.readyState&&b(c.responseText)};"POST"===a?(c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(this._serialize(d))):c.send(null)},_serialize:function(f){var d,b,a=[];for(d in f)f.hasOwnProperty(d)&&"function"!==typeof f[d]&& (function(){if("undefined"!==typeof window.XMLHttpRequest){var g={_do:function(f,d,b,a){var c=new XMLHttpRequest;"undefined"===typeof b&&(b=function(){});a=a?"POST":"GET";f+="GET"===a?"?"+this._serialize(d):"";c.open(a,f);c.onreadystatechange=function(){4===c.readyState&&b(c.responseText)};"POST"===a?(c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(this._serialize(d))):c.send(null)},_serialize:function(f){var d,b,a=[];for(d in f)f.hasOwnProperty(d)&&"function"!==typeof f[d]&&
(b=f[d].toString(),d=encodeURIComponent(d),b=encodeURIComponent(b),a.push(d+"="+b));return a.join("&")}};$_.ext("get",function(f,d,b){g._do(f,d,b,!1)});$_.ext("post",function(f,d,b){g._do(f,d,b,!0)})}})();(function(){var g=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB;indexedDB={};indexedDB={current_db:null,connect:function(f,d){this.current_db=g.open(f,d||0)}};$_.ext("indexedDB",indexedDB)})(); (b=f[d].toString(),d=encodeURIComponent(d),b=encodeURIComponent(b),a.push(d+"="+b));return a.join("&")}};$_.ext("get",function(f,d,b){g._do(f,d,b,!1)});$_.ext("post",function(f,d,b){g._do(f,d,b,!0)})}})();
(function(){var g=function(d){var b=[],a=0,c={},e,b=f.object_keys(d);b.sort(function(a,c){var b=parseFloat(c),e=parseFloat(a),d=b+""===c,f=e+""===a;return d&&f?b>e?1:b<e?-1:0:d&&!f?1:!d&&f?-1:c>a?1:c<a?-1:0});a=b.length;for(e=0;e<a;e++)c[b[e]]=d[b[e]];return c},f={object_keys:function(d){var b=[],a;for(a in d)d.hasOwnProperty(a)&&b.push(a);return b},object_values:function(d){var b=[],a;for(a in d)b.push(d[a]);return b},array_combine:function(d,b){var a={},c,e=0;"array"!==$_.type(d)&&(d=this.object_values(d));
"array"!==$_.type(b)&&(b=this.object_values(b));c=d.length;if(c!==b.length)return console.log("Object combine requires two arrays of the same size"),!1;for(e=0;e<c;e++)a[d[e]]=b[e];return a},object_merge:function(){var d=Array.prototype.slice.call(arguments),b=d.length,a={},c,e=0,f,g,h;c=!0;for(f=0;f<b;f++)if("array"!==$_.type(d[f])){c=!1;break}if(c){a=[];for(f=0;f<b;f++)a=a.contact(d[f]);return a}for(f=0,h=0;f<b;f++)if(c=d[f],"array"==$_.type(c))for(g=0,e=c.length;g<e;g++)a[h++]=c[g];else for(g in c)c.hasOwnProperty(g)&&
(parseInt(g,10)+""===g?a[h++]=c[g]:a[g]=c[g]);return a},str_trans:function(d,b,a){var c=[],e=[],f=!1,i=0,h=0,k="",l="",o="",m="",n;if("object"===typeof b){b=g(b);for(n in b)b.hasOwnProperty(n)&&(c.push(n),e.push(b[n]));b=c;a=e}h=d.length;i=b.length;k="string"===typeof a;l="string"===typeof b;for(c=0;c<h;c++){f=!1;if(l){d.charAt(c-1);o=d.charAt(c);d.charAt(c+1);for(e=0;e<i;e++)if(o==b.charAt(e)){f=!0;break}}else for(e=0;e<i;e++)if(d.substr(c,b[e].length)==b[e]){f=!0;c=c+b[e].length-1;break}m=f?m+(k?
a.charAt(e):a[e]):m+d.charAt(c)}return m}};$_.ext("util",f)})();
(function(){var g,f,d,b;"undefined"!==typeof document.addEventListener?(g=function(a,c,b){"undefined"!==typeof a.addEventListener&&a.addEventListener(c,b,!1)},f=function(a,c,b){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(c,b,!1)}):"undefined"!==typeof document.attachEvent&&(g=function(a,c,b){function d(a){b.apply(a)}"undefined"!==typeof a.attachEvent?(f(c,b),a.attachEvent("on"+c,d),a=a.KIS_0_5_0=a.KIS_0_5_0||{},a.listeners=a.listeners||{},a.listeners[c]=a.listeners[c]||[],a.listeners[c].push({callback:b, (function(){var g,f,d,b;"undefined"!==typeof document.addEventListener?(g=function(a,c,b){"undefined"!==typeof a.addEventListener&&a.addEventListener(c,b,!1)},f=function(a,c,b){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(c,b,!1)}):"undefined"!==typeof document.attachEvent&&(g=function(a,c,b){function d(a){b.apply(a)}"undefined"!==typeof a.attachEvent?(f(c,b),a.attachEvent("on"+c,d),a=a.KIS_0_5_0=a.KIS_0_5_0||{},a.listeners=a.listeners||{},a.listeners[c]=a.listeners[c]||[],a.listeners[c].push({callback:b,
_listener:d})):console.log("Failed to _attach event:"+c+" on "+a)},f=function(a,c,b){if("undefined"!==typeof a.detachEvent){var d=a.KIS_0_5_0;if(d&&d.listeners&&d.listeners[c])for(var f=d.listeners[c],g=f.length,k=0;k<g;k++)if(f[k].callback===b){a.detachEvent("on"+c,f[k]._listener);f.splice(k,1);0===f.length&&delete d.listeners[c];break}}});d=function(a,c,b,j){var i,h;if("undefined"===typeof a)return console.log(arguments),console.log(c),!1;if(c.match(/^([\w\-]+)$/))!0===j?g(a,c,b):f(a,c,b);else{c= _listener:d})):console.log("Failed to _attach event:"+c+" on "+a)},f=function(a,c,b){if("undefined"!==typeof a.detachEvent){var d=a.KIS_0_5_0;if(d&&d.listeners&&d.listeners[c])for(var f=d.listeners[c],g=f.length,k=0;k<g;k++)if(f[k].callback===b){a.detachEvent("on"+c,f[k]._listener);f.splice(k,1);0===f.length&&delete d.listeners[c];break}}});d=function(a,c,b,j){var i,h;if("undefined"===typeof a)return console.log(arguments),console.log(c),!1;if(c.match(/^([\w\-]+)$/))!0===j?g(a,c,b):f(a,c,b);else{c=
c.split(" ");h=c.length;for(i=0;i<h;i++)d(a,c[i],b,j)}};b=function(a,c,b,f){d(a,b,function(a){var b,d,e,a=a||window.event;d=$_.$(c);for(b in d)e=a.target||a.srcElement,e==d[b]&&(f.call(d[b],a),a.stopPropagation())},!0)};$_.ext("event",{add:function(a,b){$_.each(function(e){d(e,a,b,!0)})},remove:function(a,b){$_.each(function(e){d(e,a,b,!1)})},live:function(a,c,d){b(document.documentElement,a,c,d)},delegate:function(a,c,d){$_.each(function(f){b(f,a,c,d)})}})})(); c.split(" ");h=c.length;for(i=0;i<h;i++)d(a,c[i],b,j)}};b=function(a,c,b,f){d(a,b,function(a){var b,d,e,a=a||window.event;d=$_.$(c);for(b in d)e=a.target||a.srcElement,e==d[b]&&(f.call(d[b],a),a.stopPropagation())},!0)};$_.ext("event",{add:function(a,c){$_.each(function(b){d(b,a,c,!0)})},remove:function(a,b){$_.each(function(e){d(e,a,b,!1)})},live:function(a,c,d){b(document.documentElement,a,c,d)},delegate:function(a,c,d){$_.each(function(f){b(f,a,c,d)})}})})();
(function(){var g=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB||window.msIndexedDB,f={},f={current_db:null,connect:function(d,b,a){var c={},c=g.open(d,b||0);"undefined"!==typeof a&&(c.onupgradeneeded=a);c.onerror=function(){console.log("IndexedDB disallowed.")};c.onsuccess=function(){f.current_db=c.result}}};$_.ext("indexedDB",f)})();
(function(){if(!("undefined"===typeof localStorage||"undefined"===typeof JSON)){var g=localStorage,f=sessionStorage;$_.ext("store",{get:function(d,b){var a=b?f.getItem(d):g.getItem(d);return JSON.parse(a)},set:function(d,b,a){b=JSON.stringify(b);a?f.setItem(d,b):g.setItem(d,b)},remove:function(d,b){b?f.removeItem(d):g.removeItem(d)},getAll:function(d){var b,a={},c,e;e=d?g:f;b=e.length;for(d=0;d<b;d++)c=e.key(d),a[c]=e.getItem(c);return a},clear:function(d){d?f.clear():g.clear()}})}})();
(function(){if("undefined"!==$_.ajax){var g,f;g={};f={};$_.ext("template",{get:function(d){var b;b=this.el.innerHTML;if(""===b)console.log("Template is empty or cannot be found");else return g[d]=b},parse:function(d,b){var a=g[d],c=[],e=/\{([A-Z0-9_\-]+)\}(.*)\{\/\1\}/gim,j=/\{([A-Z0-9_\-]+)\}/gim,c=[],i=0,h=i=0,k=0,l="",o={},m="",n,a=(""+a).replace(/\s+/gim," "),a=a.replace(/>\s+</gim,"><"),a=a.replace(/>\s+\{/gim,">{"),a=a.replace(/\}\s+</gim,"}<"),c=a.match(e);if(null!=c){i=c.length;for(h=0;h< (function(){if("undefined"!==$_.ajax){var g,f;g={};f={};$_.ext("template",{get:function(d){var b;b=this.el.innerHTML;if(""===b)console.log("Template is empty or cannot be found");else return g[d]=b},parse:function(d,b){var a=g[d],c=[],e=/\{([A-Z0-9_\-]+)\}(.*)\{\/\1\}/gim,j=/\{([A-Z0-9_\-]+)\}/gim,c=[],i=0,h=i=0,k=0,l="",o={},m="",n,a=(""+a).replace(/\s+/gim," "),a=a.replace(/>\s+</gim,"><"),a=a.replace(/>\s+\{/gim,">{"),a=a.replace(/\}\s+</gim,"}<"),c=a.match(e);if(null!=c){i=c.length;for(h=0;h<
i;h++){a=a.replace(c[h],"{"+h+"}");m="";l=(""+c[h]).match(/^\{([A-Z0-9_\-]+)\}/i);o=b[l[1]];if(0<o.length){l=o.length;c[h]=c[h].replace(e,"$2");for(k=0;k<l;k++)m+=c[h].replace(j,function(a,b){return o[k][b]?o[k][b]:""})}a=a.replace("{"+h+"}",m)}}c=a.match(j);if(null!=c){i=c.length;for(h=0;h<i;h++)l=c[h].replace("{",""),l=l.replace("}",""),a=a.replace(c[h],b[l])}e=document.createDocumentFragment();e.appendChild(document.createElement("section"));e=e.querySelectorAll("section")[0];e.innerHTML=a;e=e.querySelectorAll('[src=""], [href=""]'); i;h++){a=a.replace(c[h],"{"+h+"}");m="";l=(""+c[h]).match(/^\{([A-Z0-9_\-]+)\}/i);o=b[l[1]];if(0<o.length){l=o.length;c[h]=c[h].replace(e,"$2");for(k=0;k<l;k++)m+=c[h].replace(j,function(a,b){return o[k][b]?o[k][b]:""})}a=a.replace("{"+h+"}",m)}}c=a.match(j);if(null!=c){i=c.length;for(h=0;h<i;h++)l=c[h].replace("{",""),l=l.replace("}",""),a=a.replace(c[h],b[l])}e=document.createDocumentFragment();e.appendChild(document.createElement("section"));e=e.querySelectorAll("section")[0];e.innerHTML=a;e=e.querySelectorAll('[src=""], [href=""]');
for(n in e)e[n].parentNode&&e[n].parentNode.removeChild(e[n]);return f[d]=a},apply:function(d,b,a){"undefined"===typeof b&&"undefined"===typeof a?this.el.innerHTML="undefined"!==typeof f[d]?f[d]:d:$_.get(b,{},function(b){""===b?console.log("Template is empty or can not be found"):(g[d]=b,b=this.parse(d,a),f[d]=b,this.el.innerHTML=b)})}})}})(); for(n in e)e[n].parentNode&&e[n].parentNode.removeChild(e[n]);return f[d]=a},apply:function(d,b,a){"undefined"===typeof b&&"undefined"===typeof a?this.el.innerHTML="undefined"!==typeof f[d]?f[d]:d:$_.get(b,{},function(b){""===b?console.log("Template is empty or can not be found"):(g[d]=b,b=this.parse(d,a),f[d]=b,this.el.innerHTML=b)})}})}})();
(function(){var g=function(d){var b=[],a=0,c={},e,b=f.object_keys(d);b.sort(function(a,b){var c=parseFloat(b),d=parseFloat(a),e=c+""===b,f=d+""===a;return e&&f?c>d?1:c<d?-1:0:e&&!f?1:!e&&f?-1:b>a?1:b<a?-1:0});a=b.length;for(e=0;e<a;e++)c[b[e]]=d[b[e]];return c},f={object_keys:function(d){var b=[],a;for(a in d)d.hasOwnProperty(a)&&b.push(a);return b},object_values:function(d){var b=[],a;for(a in d)b.push(d[a]);return b},array_combine:function(d,b){var a={},c,e=0;"array"!==$_.type(d)&&(d=this.object_values(d));
"array"!==$_.type(b)&&(b=this.object_values(b));c=d.length;if(c!==b.length)return console.log("Object combine requires two arrays of the same size"),!1;for(e=0;e<c;e++)a[d[e]]=b[e];return a},object_merge:function(){var d=Array.prototype.slice.call(arguments),b=d.length,a={},c,e=0,f,g,h;c=!0;for(f=0;f<b;f++)if("array"!==$_.type(d[f])){c=!1;break}if(c){a=[];for(f=0;f<b;f++)a=a.contact(d[f]);return a}for(f=0,h=0;f<b;f++)if(c=d[f],"array"==$_.type(c))for(g=0,e=c.length;g<e;g++)a[h++]=c[g];else for(g in c)c.hasOwnProperty(g)&&
(parseInt(g,10)+""===g?a[h++]=c[g]:a[g]=c[g]);return a},str_trans:function(d,b,a){var c=[],e=[],f=!1,i=0,h=0,k="",l="",o="",m="",n;if("object"===typeof b){b=g(b);for(n in b)b.hasOwnProperty(n)&&(c.push(n),e.push(b[n]));b=c;a=e}h=d.length;i=b.length;k="string"===typeof a;l="string"===typeof b;for(c=0;c<h;c++){f=!1;if(l){d.charAt(c-1);o=d.charAt(c);d.charAt(c+1);for(e=0;e<i;e++)if(o==b.charAt(e)){f=!0;break}}else for(e=0;e<i;e++)if(d.substr(c,b[e].length)==b[e]){f=!0;c=c+b[e].length-1;break}m=f?m+(k?
a.charAt(e):a[e]):m+d.charAt(c)}return m}};$_.ext("util",f)})();

View File

@ -5,26 +5,8 @@
"use strict"; "use strict";
var db = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB, var db = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB,
request = null;
indexedDB = {}; indexedDB = {};
/**
* @private
*/
request.onerror = function(event)
{
console.log("IndexedDB disallowed.");
};
/**
* @private
*/
request.onsuccess = function(event)
{
// Connect to the specified db
indexedDB.current_db = request.result;
};
/** /**
* Module for simplifying Indexed DB access * Module for simplifying Indexed DB access
* *
@ -46,15 +28,35 @@
*/ */
connect: function(dbname, version, onupgradeneeded) connect: function(dbname, version, onupgradeneeded)
{ {
var request = {};
version = version || 0; version = version || 0;
// Ask for permission to use db
request = db.open(dbname, version);
// Assign onupgradeneeded callback
if(typeof onupgradeneeded !== "undefined") if(typeof onupgradeneeded !== "undefined")
{ {
request.onupgradeneeded = onupgradeneeded; request.onupgradeneeded = onupgradeneeded;
} }
// Ask for permission to use db /**
this.current_db = db.open(dbname, version); * @private
*/
request.onerror = function(event)
{
console.log("IndexedDB disallowed.");
};
/**
* @private
*/
request.onsuccess = function(event)
{
// Connect to the specified db
indexedDB.current_db = request.result;
};
} }
}; };

View File

@ -32,7 +32,7 @@ for (var i = 0, tagName; tagName = HTML5[i]; i++) document.createElement(tagName
<div class="nephew"></div> <div class="nephew"></div>
</aside> </aside>
</section> </section>
<script src="../kis-custom.js"></script> <script src="../kis-all.js"></script>
<script src="qunit/qunit.js"></script> <script src="qunit/qunit.js"></script>
<script type="text/javascript"> <script type="text/javascript">
//Selector test function //Selector test function

View File

@ -1,5 +1,5 @@
/** /**
* QUnit 1.2.0pre - A JavaScript Unit Testing Framework * QUnit v1.3.0pre - A JavaScript Unit Testing Framework
* *
* http://docs.jquery.com/QUnit * http://docs.jquery.com/QUnit
* *

View File

@ -1,5 +1,5 @@
/** /**
* QUnit 1.2.0pre - A JavaScript Unit Testing Framework * QUnit v1.3.0pre - A JavaScript Unit Testing Framework
* *
* http://docs.jquery.com/QUnit * http://docs.jquery.com/QUnit
* *
@ -274,7 +274,7 @@ var QUnit = {
}, },
test: function(testName, expected, callback, async) { test: function(testName, expected, callback, async) {
var name = '<span class="test-name">' + testName + '</span>', testEnvironmentArg; var name = '<span class="test-name">' + escapeInnerText(testName) + '</span>', testEnvironmentArg;
if ( arguments.length === 2 ) { if ( arguments.length === 2 ) {
callback = expected; callback = expected;
@ -989,6 +989,7 @@ function fail(message, exception, callback) {
if ( typeof console !== "undefined" && console.error && console.warn ) { if ( typeof console !== "undefined" && console.error && console.warn ) {
console.error(message); console.error(message);
console.error(exception); console.error(exception);
console.error(exception.stack);
console.warn(callback.toString()); console.warn(callback.toString());
} else if ( window.opera && opera.postError ) { } else if ( window.opera && opera.postError ) {
@ -1065,6 +1066,10 @@ QUnit.equiv = function () {
} }
} }
var getProto = Object.getPrototypeOf || function (obj) {
return obj.__proto__;
};
var callbacks = function () { var callbacks = function () {
// for string, boolean, number and null // for string, boolean, number and null
@ -1154,7 +1159,13 @@ QUnit.equiv = function () {
// comparing constructors is more strict than using // comparing constructors is more strict than using
// instanceof // instanceof
if (a.constructor !== b.constructor) { if (a.constructor !== b.constructor) {
return false; // Allow objects with no prototype to be equivalent to
// objects with Object as their constructor.
if (!((getProto(a) === null && getProto(b) === Object.prototype) ||
(getProto(b) === null && getProto(a) === Object.prototype)))
{
return false;
}
} }
// stack constructor before traversing properties // stack constructor before traversing properties