Removed classlist polyfill from kis-lite.js
@ -51,7 +51,7 @@ Browser support: IE8+, Latest versions of Firefox, Chrome, Safari, Opera
|
||||
|
||||
Have a look at the /docs folder included with the library for documentation on the included modules. The development version of the documentation is avaliable at
|
||||
|
||||
[http://dev.timshomepage.net/github/kis-js/docs/](http://dev.timshomepage.net/github/kis-js/docs/)
|
||||
[http://github.timshomepage.net/kis-js/docs/](http://github.timshomepage.net/kis-js/docs/)
|
||||
|
||||
#### Lite Versions ####
|
||||
|
||||
|
0
docs/code.css
Normal file → Executable file
0
docs/css/all.css
Normal file → Executable file
0
docs/css/fonts/mplus-1m-bold-webfont.eot
Normal file → Executable file
0
docs/css/fonts/mplus-1m-bold-webfont.svg
Normal file → Executable file
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
0
docs/css/fonts/mplus-1m-bold-webfont.ttf
Normal file → Executable file
0
docs/css/fonts/mplus-1m-bold-webfont.woff
Normal file → Executable file
0
docs/css/fonts/mplus-1m-regular-webfont.eot
Normal file → Executable file
0
docs/css/fonts/mplus-1m-regular-webfont.svg
Normal file → Executable file
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
0
docs/css/fonts/mplus-1m-regular-webfont.ttf
Normal file → Executable file
0
docs/css/fonts/mplus-1m-regular-webfont.woff
Normal file → Executable file
0
docs/css/handheld.css
Normal file → Executable file
0
docs/css/screen.css
Normal file → Executable file
0
docs/default.css
Normal file → Executable file
0
docs/files.html
Normal file → Executable file
0
docs/images/bg.png
Normal file → Executable file
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
0
docs/images/class_default_obj.png
Normal file → Executable file
Before Width: | Height: | Size: 609 B After Width: | Height: | Size: 609 B |
0
docs/images/class_obj.png
Normal file → Executable file
Before Width: | Height: | Size: 529 B After Width: | Height: | Size: 529 B |
0
docs/images/collapsebtn.gif
Normal file → Executable file
Before Width: | Height: | Size: 273 B After Width: | Height: | Size: 273 B |
0
docs/images/expandbtn.gif
Normal file → Executable file
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
0
docs/images/field_private_obj.png
Normal file → Executable file
Before Width: | Height: | Size: 127 B After Width: | Height: | Size: 127 B |
0
docs/images/field_public_obj.png
Normal file → Executable file
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
0
docs/images/file_obj.png
Normal file → Executable file
Before Width: | Height: | Size: 425 B After Width: | Height: | Size: 425 B |
0
docs/images/method_private_obj.png
Normal file → Executable file
Before Width: | Height: | Size: 197 B After Width: | Height: | Size: 197 B |
0
docs/images/method_public_obj.png
Normal file → Executable file
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 255 B |
0
docs/images/minus.gif
Normal file → Executable file
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 114 B |
0
docs/images/namespace_function_obj.png
Normal file → Executable file
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
0
docs/images/namespace_obj.png
Normal file → Executable file
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
0
docs/images/never_translate.png
Normal file → Executable file
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
0
docs/images/plus.gif
Normal file → Executable file
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |
0
docs/index.html
Normal file → Executable file
0
docs/javascript/all.js
Normal file → Executable file
0
docs/javascript/html5.js
Normal file → Executable file
0
docs/jproton.js
Normal file → Executable file
0
docs/sh.css
Normal file → Executable file
0
docs/sh.js
Normal file → Executable file
0
docs/symbols/$_.dom.html
Normal file → Executable file
0
docs/symbols/$_.event.html
Normal file → Executable file
0
docs/symbols/$_.html
Normal file → Executable file
0
docs/symbols/$_.store.html
Normal file → Executable file
0
docs/symbols/$_.template.html
Normal file → Executable file
0
docs/symbols/$_.util.html
Normal file → Executable file
0
docs/symbols/_global_.html
Normal file → Executable file
0
docs/symbols/src/kis-js_src_core.js.html
Normal file → Executable file
885
docs/symbols/src/kis-js_src_modules_DOM.js.html
Normal file → Executable file
@ -5,373 +5,540 @@
|
||||
.STRN {color: #393;}
|
||||
.REGX {color: #339;}
|
||||
.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
|
||||
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">/**
|
||||
<span class='line'> 2</span> * DOM
|
||||
<span class='line'> 3</span> *
|
||||
<span class='line'> 4</span> * Dom manipulation module
|
||||
<span class='line'> 5</span> */</span><span class="WHIT">
|
||||
<span class='line'> 6</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 7</span>
|
||||
<span class='line'> 8</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 9</span>
|
||||
<span class='line'> 10</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 11</span> </span><span class="WHIT">
|
||||
<span class='line'> 12</span> </span><span class="COMM">//Private function for getting/setting attributes/properties</span><span class="WHIT">
|
||||
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_attr</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">doAttr</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 16</span>
|
||||
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="COMM">//Get the value of the attribute, if it exists</span><span class="WHIT">
|
||||
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.hasAttribute</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'> 19</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel.hasAttribute</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||
</style></head><body><pre><span class='line'> 1</span> <span class="COMM">//This is used so IE 8 can use the classList api</span><span class="WHIT">
|
||||
<span class='line'> 2</span> </span><span class="COMM">/*
|
||||
<span class='line'> 3</span> * classList.js: Cross-browser full element.classList implementation.
|
||||
<span class='line'> 4</span> * 2011-06-15
|
||||
<span class='line'> 5</span> *
|
||||
<span class='line'> 6</span> * By Eli Grey, http://eligrey.com
|
||||
<span class='line'> 7</span> * Public Domain.
|
||||
<span class='line'> 8</span> * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
<span class='line'> 9</span> */</span><span class="WHIT">
|
||||
<span class='line'> 10</span>
|
||||
<span class='line'> 11</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="PUNC">(</span><span class="STRN">"classList"</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">"a"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 12</span> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">view</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 14</span> </span><span class="WHIT">
|
||||
<span class='line'> 15</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">classListProp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"classList"</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="NAME">protoProp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"prototype"</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">elemCtrProto</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">view.HTMLElement</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">view.Element</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">protoProp</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="NAME">objCtr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Object</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="NAME">strTrim</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">String</span><span class="PUNC">[</span><span class="NAME">protoProp</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">trim</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
|
||||
<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel.getAttribute</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 24</span>
|
||||
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</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'> 28</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 31</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 32</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"class"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.className</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><span class="COMM">//className attribute</span><span class="WHIT">
|
||||
<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"className"</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel.className</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 38</span>
|
||||
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="COMM">//Well, I guess that attribute doesn't exist</span><span class="WHIT">
|
||||
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Element does not have the selected attribute"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 47</span>
|
||||
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="COMM">//No value to set? Return the current value</span><span class="WHIT">
|
||||
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</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'> 50</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 52</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 53</span>
|
||||
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="COMM">//Determine what to do with the attribute</span><span class="WHIT">
|
||||
<span class='line'> 55</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">value</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'> 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="KEYW">if</span><span class="PUNC">(</span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="NAME">sel.setAttribute</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</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="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 65</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</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'> 67</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.replace</span><span class="PUNC">(</span><span class="REGX">/^\s+|\s+$/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="NAME">arrIndexOf</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">[</span><span class="NAME">protoProp</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
|
||||
<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT">
|
||||
<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="NAME">i</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'> 29</span> </span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 31</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 32</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">item</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="COMM">// Vendors: please allow content code to instantiate DOMExceptions</span><span class="WHIT">
|
||||
<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'> 42</span> * @private
|
||||
<span class='line'> 43</span> */</span><span class="WHIT">
|
||||
<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="NAME">DOMEx</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="NAME">this.name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="NAME">this.code</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">DOMException</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="NAME">this.message</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'> 51</span> * @private
|
||||
<span class='line'> 52</span> */</span><span class="WHIT">
|
||||
<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="NAME">checkTokenAndGetIndex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">classList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">token</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 55</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">token</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</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="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">DOMEx</span><span class="PUNC">(</span><span class="STRN">"SYNTAX_ERR"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"An invalid or illegal string was specified"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 59</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="REGX">/\s/</span><span class="PUNC">.</span><span class="NAME">test</span><span class="PUNC">(</span><span class="NAME">token</span><span class="PUNC">)</span><span class="PUNC">)</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="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">DOMEx</span><span class="PUNC">(</span><span class="STRN">"INVALID_CHARACTER_ERR"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"String contains an invalid character"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">arrIndexOf.call</span><span class="PUNC">(</span><span class="NAME">classList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">token</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'> 66</span> * @private
|
||||
<span class='line'> 67</span> */</span><span class="WHIT">
|
||||
<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="NAME">ClassList</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">elem</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 69</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 70</span> </span><span class="WHIT"> </span><span class="NAME">sel.removeAttribute</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 71</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 72</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||
<span class='line'> 73</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 74</span> </span><span class="WHIT"> </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 76</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 77</span>
|
||||
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</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><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 80</span> </span><span class="WHIT">
|
||||
<span class='line'> 81</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_toCamel</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 82</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">s.replace</span><span class="PUNC">(</span><span class="REGX">/(\-[a-z])/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">$1</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">$1.toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="STRN">'-'</span><span class="PUNC">,</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 86</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 87</span>
|
||||
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">equi</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 91</span> </span><span class="WHIT">
|
||||
<span class='line'> 92</span> </span><span class="COMM">//Camel-case</span><span class="WHIT">
|
||||
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_toCamel</span><span class="PUNC">(</span><span class="NAME">prop</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 94</span>
|
||||
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="COMM">//Equivalent properties for 'special' browsers</span><span class="WHIT">
|
||||
<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="NAME">equi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="NAME">outerHeight</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"offsetHeight"</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="NAME">outerWidth</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"offsetWidth"</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 99</span> </span><span class="WHIT"> </span><span class="NAME">top</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"posTop"</span><span class="WHIT">
|
||||
<span class='line'>100</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>101</span> </span><span class="WHIT">
|
||||
<span class='line'>102</span>
|
||||
<span class='line'>103</span> </span><span class="COMM">//If you don't define a value, try returning the existing value</span><span class="WHIT">
|
||||
<span class='line'>104</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">val</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</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'> 70</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT">
|
||||
<span class='line'> 71</span> </span><span class="WHIT"> </span><span class="NAME">trimmedClasses</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">strTrim.call</span><span class="PUNC">(</span><span class="NAME">elem.className</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 72</span> </span><span class="WHIT"> </span><span class="NAME">classes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">trimmedClasses</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">trimmedClasses.split</span><span class="PUNC">(</span><span class="REGX">/\s+/</span><span class="PUNC">)</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'> 73</span> </span><span class="WHIT"> </span><span class="NAME">i</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'> 74</span> </span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">classes.length</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC"><</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="NAME">this.push</span><span class="PUNC">(</span><span class="NAME">classes</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="NAME">this._updateClassName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 81</span> </span><span class="WHIT"> </span><span class="NAME">elem.className</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 82</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="NAME">classListProto</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ClassList</span><span class="PUNC">[</span><span class="NAME">protoProp</span><span class="PUNC">]</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'> 85</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'> 86</span> * @private
|
||||
<span class='line'> 87</span> */</span><span class="WHIT">
|
||||
<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="NAME">classListGetter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ClassList</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="COMM">// Most DOMException implementations don't allow calling DOMException's toString()</span><span class="WHIT">
|
||||
<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="COMM">// on non-DOMExceptions. Error's toString() is sufficient here.</span><span class="WHIT">
|
||||
<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="NAME">DOMEx</span><span class="PUNC">[</span><span class="NAME">protoProp</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">[</span><span class="NAME">protoProp</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="NAME">classListProto.item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</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'> 98</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'> 99</span> </span><span class="WHIT"> </span><span class="NAME">classListProto.contains</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">token</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>100</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>101</span> </span><span class="WHIT"> </span><span class="NAME">token</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>102</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">checkTokenAndGetIndex</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">token</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>103</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>104</span> </span><span class="WHIT"> </span><span class="NAME">classListProto.add</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">token</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>105</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>106</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="KEYW">else</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">val</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</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'>109</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>111</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>112</span>
|
||||
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="COMM">//Let's try the easy way first</span><span class="WHIT">
|
||||
<span class='line'>114</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">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</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'>115</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>116</span> </span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>117</span>
|
||||
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="COMM">//Short circuit</span><span class="WHIT">
|
||||
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>120</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>121</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>122</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>123</span> </span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>125</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>126</span> </span><span class="WHIT">
|
||||
<span class='line'>127</span> </span><span class="COMM">//No matches? Well, lets log it for now</span><span class="WHIT">
|
||||
<span class='line'>128</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Property "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" nor an equivalent seems to exist"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>129</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>130</span> </span><span class="WHIT">
|
||||
<span class='line'>131</span> </span><span class="COMM">// --------------------------------------------------------------------------</span><span class="WHIT">
|
||||
<span class='line'>132</span>
|
||||
<span class='line'>133</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>134</span> * DOM
|
||||
<span class='line'>135</span> *
|
||||
<span class='line'>136</span> * Dom manipulation module
|
||||
<span class='line'>137</span> * @namespace
|
||||
<span class='line'>138</span> * @memberOf $_
|
||||
<span class='line'>139</span> * @name dom
|
||||
<span class='line'>140</span> */</span><span class="WHIT">
|
||||
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>143</span> * Adds a class to the element(s) specified by the current
|
||||
<span class='line'>144</span> * selector
|
||||
<span class='line'>145</span> *
|
||||
<span class='line'>146</span> * @name addClass
|
||||
<span class='line'>147</span> * @memberOf $_.dom
|
||||
<span class='line'>148</span> * @function
|
||||
<span class='line'>149</span> * @param string class
|
||||
<span class='line'>150</span> */</span><span class="WHIT">
|
||||
<span class='line'>151</span> </span><span class="WHIT"> </span><span class="NAME">addClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>152</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>153</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>154</span> </span><span class="WHIT"> </span><span class="NAME">e.classList.add</span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>155</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>156</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>157</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>158</span> * Removes a class from the element(s) specified by the current
|
||||
<span class='line'>159</span> * selector
|
||||
<span class='line'>160</span> *
|
||||
<span class='line'>161</span> * @name removeClass
|
||||
<span class='line'>162</span> * @memberOf $_.dom
|
||||
<span class='line'>163</span> * @function
|
||||
<span class='line'>164</span> * @param string class
|
||||
<span class='line'>165</span> */</span><span class="WHIT">
|
||||
<span class='line'>166</span> </span><span class="WHIT"> </span><span class="NAME">removeClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>167</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>168</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>169</span> </span><span class="WHIT"> </span><span class="NAME">e.classList.remove</span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>170</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>171</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>172</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>173</span> * Hides the element(s) specified by the current selector
|
||||
<span class='line'>174</span> *
|
||||
<span class='line'>175</span> * @name hide
|
||||
<span class='line'>176</span> * @memberOf $_.dom
|
||||
<span class='line'>177</span> * @function
|
||||
<span class='line'>178</span> */</span><span class="WHIT">
|
||||
<span class='line'>179</span> </span><span class="WHIT"> </span><span class="NAME">hide</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>181</span> </span><span class="WHIT"> </span><span class="NAME">this.css</span><span class="PUNC">(</span><span class="STRN">'display'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'none'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>182</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>183</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>184</span> * Shows the element(s) specified by the current selector.
|
||||
<span class='line'>185</span> * if type is specified, the element will have it's style
|
||||
<span class='line'>186</span> * property set to "display:[your type]". If type is not
|
||||
<span class='line'>187</span> * specified, the element is set to "display:block".
|
||||
<span class='line'>188</span> *
|
||||
<span class='line'>189</span> * @name show
|
||||
<span class='line'>190</span> * @memberOf $_.dom
|
||||
<span class='line'>191</span> * @function
|
||||
<span class='line'>192</span> * @param [string] type
|
||||
<span class='line'>193</span> */</span><span class="WHIT">
|
||||
<span class='line'>194</span> </span><span class="WHIT"> </span><span class="NAME">show</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>106</span> </span><span class="WHIT"> </span><span class="NAME">token</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>107</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">checkTokenAndGetIndex</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">token</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>108</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>109</span> </span><span class="WHIT"> </span><span class="NAME">this.push</span><span class="PUNC">(</span><span class="NAME">token</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>110</span> </span><span class="WHIT"> </span><span class="NAME">this._updateClassName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>111</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>112</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>113</span> </span><span class="WHIT"> </span><span class="NAME">classListProto.remove</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">token</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>114</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>115</span> </span><span class="WHIT"> </span><span class="NAME">token</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>116</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">checkTokenAndGetIndex</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">token</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>117</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>118</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>119</span> </span><span class="WHIT"> </span><span class="NAME">this.splice</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>120</span> </span><span class="WHIT"> </span><span class="NAME">this._updateClassName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>121</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>122</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>123</span> </span><span class="WHIT"> </span><span class="NAME">classListProto.toggle</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">token</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>124</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>125</span> </span><span class="WHIT"> </span><span class="NAME">token</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>126</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">checkTokenAndGetIndex</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">token</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>127</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>128</span> </span><span class="WHIT"> </span><span class="NAME">this.add</span><span class="PUNC">(</span><span class="NAME">token</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>129</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>130</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||
<span class='line'>131</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>132</span> </span><span class="WHIT"> </span><span class="NAME">this.remove</span><span class="PUNC">(</span><span class="NAME">token</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>133</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>134</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>135</span> </span><span class="WHIT"> </span><span class="NAME">classListProto.toString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>136</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>137</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.join</span><span class="PUNC">(</span><span class="STRN">" "</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>138</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>139</span>
|
||||
<span class='line'>140</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">objCtr.defineProperty</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>141</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>142</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">classListPropDesc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>143</span> </span><span class="WHIT"> </span><span class="NAME">get</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">classListGetter</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>144</span> </span><span class="WHIT"> </span><span class="NAME">enumerable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>145</span> </span><span class="WHIT"> </span><span class="NAME">configurable</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT">
|
||||
<span class='line'>146</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>147</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="WHIT">
|
||||
<span class='line'>148</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>149</span> </span><span class="WHIT"> </span><span class="NAME">objCtr.defineProperty</span><span class="PUNC">(</span><span class="NAME">elemCtrProto</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">classListProp</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">classListPropDesc</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>150</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>151</span> </span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ex</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>152</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// IE 8 doesn't support enumerable:true</span><span class="WHIT">
|
||||
<span class='line'>153</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ex.number</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">0x7FF5EC54</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>154</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>155</span> </span><span class="WHIT"> </span><span class="NAME">classListPropDesc.enumerable</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>156</span> </span><span class="WHIT"> </span><span class="NAME">objCtr.defineProperty</span><span class="PUNC">(</span><span class="NAME">elemCtrProto</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">classListProp</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">classListPropDesc</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>157</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>158</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>159</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>160</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">objCtr</span><span class="PUNC">[</span><span class="NAME">protoProp</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">__defineGetter__</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>161</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>162</span> </span><span class="WHIT"> </span><span class="NAME">elemCtrProto.__defineGetter__</span><span class="PUNC">(</span><span class="NAME">classListProp</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">classListGetter</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>163</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>164</span>
|
||||
<span class='line'>165</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="NAME">self</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>166</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>167</span>
|
||||
<span class='line'>168</span> </span><span class="COMM">/**
|
||||
<span class='line'>169</span> * DOM
|
||||
<span class='line'>170</span> *
|
||||
<span class='line'>171</span> * Dom manipulation module
|
||||
<span class='line'>172</span> */</span><span class="WHIT">
|
||||
<span class='line'>173</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>174</span>
|
||||
<span class='line'>175</span> </span><span class="WHIT"> </span><span class="STRN">"use strict"</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>176</span>
|
||||
<span class='line'>177</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>178</span> </span><span class="WHIT">
|
||||
<span class='line'>179</span> </span><span class="COMM">//Private function for getting/setting attributes/properties</span><span class="WHIT">
|
||||
<span class='line'>180</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_attr</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>181</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>182</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">doAttr</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>183</span>
|
||||
<span class='line'>184</span> </span><span class="WHIT"> </span><span class="COMM">//Get the value of the attribute, if it exists</span><span class="WHIT">
|
||||
<span class='line'>185</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.hasAttribute</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'>186</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>187</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel.hasAttribute</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>188</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>189</span> </span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel.getAttribute</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>190</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>191</span>
|
||||
<span class='line'>192</span> </span><span class="WHIT"> </span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>193</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>194</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</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'>195</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>196</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">type</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'>197</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"block"</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>200</span>
|
||||
<span class='line'>201</span> </span><span class="WHIT"> </span><span class="NAME">this.css</span><span class="PUNC">(</span><span class="STRN">"display"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>204</span> * Sets attributes on element(s) specified by the current
|
||||
<span class='line'>205</span> * selector, or, if name is not specified, returns the
|
||||
<span class='line'>206</span> * value of the attribute of the element specified by the
|
||||
<span class='line'>207</span> * current selector.
|
||||
<span class='line'>208</span> *
|
||||
<span class='line'>209</span> * @name attr
|
||||
<span class='line'>210</span> * @memberOf $_.dom
|
||||
<span class='line'>211</span> * @function
|
||||
<span class='line'>212</span> * @param string name
|
||||
<span class='line'>213</span> * @param [string] value
|
||||
<span class='line'>214</span> * @return string
|
||||
<span class='line'>215</span> * @type string
|
||||
<span class='line'>216</span> */</span><span class="WHIT">
|
||||
<span class='line'>217</span> </span><span class="WHIT"> </span><span class="NAME">attr</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.el</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>196</span> </span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>197</span> </span><span class="WHIT"> </span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>198</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>199</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"class"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.className</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><span class="COMM">//className attribute</span><span class="WHIT">
|
||||
<span class='line'>200</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>201</span> </span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"className"</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>202</span> </span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel.className</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>203</span> </span><span class="WHIT"> </span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>204</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>205</span>
|
||||
<span class='line'>206</span> </span><span class="WHIT"> </span><span class="COMM">//Well, I guess that attribute doesn't exist</span><span class="WHIT">
|
||||
<span class='line'>207</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>208</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>209</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>210</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>211</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Element does not have the selected attribute"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>212</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>213</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>214</span>
|
||||
<span class='line'>215</span> </span><span class="WHIT"> </span><span class="COMM">//No value to set? Return the current value</span><span class="WHIT">
|
||||
<span class='line'>216</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</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'>217</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>218</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>219</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>220</span>
|
||||
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="COMM">//Make sure you don't try to get a bunch of elements</span><span class="WHIT">
|
||||
<span class='line'>222</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</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'>223</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>224</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>225</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Must be a singular element"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>226</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>221</span> </span><span class="WHIT"> </span><span class="COMM">//Determine what to do with the attribute</span><span class="WHIT">
|
||||
<span class='line'>222</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">value</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'>223</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>224</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>225</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>226</span> </span><span class="WHIT"> </span><span class="NAME">sel.setAttribute</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>227</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>228</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</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><span class="COMM">//You can set a bunch, though</span><span class="WHIT">
|
||||
<span class='line'>228</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||
<span class='line'>229</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_attr</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>232</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>234</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="COMM">//Normal behavior</span><span class="WHIT">
|
||||
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>236</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_attr</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>237</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>238</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>240</span> * Sets or retrieves the text content of the element
|
||||
<span class='line'>241</span> * specified by the current selector. If a value is
|
||||
<span class='line'>242</span> * passed, it will set that value on the current element,
|
||||
<span class='line'>243</span> * otherwise it will return the value of the current element
|
||||
<span class='line'>244</span> *
|
||||
<span class='line'>245</span> * @name text
|
||||
<span class='line'>246</span> * @memberOf $_.dom
|
||||
<span class='line'>247</span> * @function
|
||||
<span class='line'>248</span> * @param [string] value
|
||||
<span class='line'>249</span> * @return string
|
||||
<span class='line'>250</span> * @type string
|
||||
<span class='line'>251</span> */</span><span class="WHIT">
|
||||
<span class='line'>252</span> </span><span class="WHIT"> </span><span class="NAME">text</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>253</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>254</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldValue</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">set</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>255</span> </span><span class="WHIT">
|
||||
<span class='line'>256</span> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.el</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>257</span> </span><span class="WHIT">
|
||||
<span class='line'>258</span> </span><span class="NAME">set</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</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><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>259</span> </span><span class="WHIT">
|
||||
<span class='line'>260</span> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.innerText</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'>261</span> </span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"innerText"</span><span class="WHIT">
|
||||
<span class='line'>262</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.textContent</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'>263</span> </span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"textContent"</span><span class="WHIT">
|
||||
<span class='line'>264</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"innerHTML"</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>265</span>
|
||||
<span class='line'>266</span> </span><span class="WHIT"> </span><span class="NAME">oldValue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>267</span> </span><span class="WHIT">
|
||||
<span class='line'>268</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">set</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>269</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>270</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>271</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>272</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>273</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||
<span class='line'>274</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>275</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">oldValue</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>276</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>277</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>278</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>279</span> * Sets or retrieves a css property of the element
|
||||
<span class='line'>280</span> * specified by the current selector. If a value is
|
||||
<span class='line'>281</span> * passed, it will set that value on the current element,
|
||||
<span class='line'>282</span> * otherwise it will return the value of the css property
|
||||
<span class='line'>283</span> * on the current element
|
||||
<span class='line'>284</span> *
|
||||
<span class='line'>285</span> * @name css
|
||||
<span class='line'>286</span> * @memberOf $_.dom
|
||||
<span class='line'>287</span> * @function
|
||||
<span class='line'>288</span> * @param string property
|
||||
<span class='line'>289</span> * @param [string] value
|
||||
<span class='line'>290</span> * @return string
|
||||
<span class='line'>291</span> * @type string
|
||||
<span class='line'>292</span> */</span><span class="WHIT">
|
||||
<span class='line'>293</span> </span><span class="WHIT"> </span><span class="NAME">css</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">prop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>294</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>295</span> </span><span class="WHIT"> </span><span class="COMM">//Return the current value if a value is not set</span><span class="WHIT">
|
||||
<span class='line'>296</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">val</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'>297</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>298</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">this.el</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>299</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>300</span> </span><span class="WHIT">
|
||||
<span class='line'>301</span> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>302</span> </span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>303</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>304</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>305</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>306</span> * Adds to the innerHTML of the current element, after the last child.
|
||||
<span class='line'>307</span> *
|
||||
<span class='line'>308</span> * @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
|
||||
<span class='line'>309</span> * @name append
|
||||
<span class='line'>310</span> * @memberOf $_.dom
|
||||
<span class='line'>311</span> * @function
|
||||
<span class='line'>312</span> * @param string htm
|
||||
<span class='line'>313</span> */</span><span class="WHIT">
|
||||
<span class='line'>314</span> </span><span class="WHIT"> </span><span class="NAME">append</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>315</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>316</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">document.insertAdjacentHTML</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'>317</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>318</span> </span><span class="WHIT"> </span><span class="NAME">this.el.insertAdjacentHTML</span><span class="PUNC">(</span><span class="STRN">'beforeend'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>319</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>320</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||
<span class='line'>321</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>322</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>323</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>324</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>325</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>326</span> * Adds to the innerHTML of the selected element, before the current children
|
||||
<span class='line'>230</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>231</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>232</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>233</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</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'>234</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>235</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">doAttr</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>236</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>237</span> </span><span class="WHIT"> </span><span class="NAME">sel.removeAttribute</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>238</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>239</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||
<span class='line'>240</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>241</span> </span><span class="WHIT"> </span><span class="KEYW">delete</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>242</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>243</span> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>244</span>
|
||||
<span class='line'>245</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</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><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">oldVal</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>246</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>247</span> </span><span class="WHIT">
|
||||
<span class='line'>248</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_toCamel</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>249</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>250</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">s.replace</span><span class="PUNC">(</span><span class="REGX">/(\-[a-z])/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">$1</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>251</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">$1.toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="STRN">'-'</span><span class="PUNC">,</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>252</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>253</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>254</span>
|
||||
<span class='line'>255</span> </span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>256</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>257</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">equi</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>258</span> </span><span class="WHIT">
|
||||
<span class='line'>259</span> </span><span class="COMM">//Camel-case</span><span class="WHIT">
|
||||
<span class='line'>260</span> </span><span class="WHIT"> </span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_toCamel</span><span class="PUNC">(</span><span class="NAME">prop</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>261</span>
|
||||
<span class='line'>262</span> </span><span class="WHIT"> </span><span class="COMM">//Equivalent properties for 'special' browsers</span><span class="WHIT">
|
||||
<span class='line'>263</span> </span><span class="WHIT"> </span><span class="NAME">equi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>264</span> </span><span class="WHIT"> </span><span class="NAME">outerHeight</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"offsetHeight"</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>265</span> </span><span class="WHIT"> </span><span class="NAME">outerWidth</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"offsetWidth"</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>266</span> </span><span class="WHIT"> </span><span class="NAME">top</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"posTop"</span><span class="WHIT">
|
||||
<span class='line'>267</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>268</span> </span><span class="WHIT">
|
||||
<span class='line'>269</span>
|
||||
<span class='line'>270</span> </span><span class="COMM">//If you don't define a value, try returning the existing value</span><span class="WHIT">
|
||||
<span class='line'>271</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">val</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</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'>272</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>273</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>274</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>275</span> </span><span class="WHIT"> </span><span class="KEYW">else</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">val</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</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'>276</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>277</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>278</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>279</span>
|
||||
<span class='line'>280</span> </span><span class="WHIT"> </span><span class="COMM">//Let's try the easy way first</span><span class="WHIT">
|
||||
<span class='line'>281</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">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</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'>282</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>283</span> </span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>284</span>
|
||||
<span class='line'>285</span> </span><span class="WHIT"> </span><span class="COMM">//Short circuit</span><span class="WHIT">
|
||||
<span class='line'>286</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>287</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>288</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>289</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>290</span> </span><span class="WHIT"> </span><span class="NAME">sel.style</span><span class="PUNC">[</span><span class="NAME">equi</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>291</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>292</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>293</span> </span><span class="WHIT">
|
||||
<span class='line'>294</span> </span><span class="COMM">//No matches? Well, lets log it for now</span><span class="WHIT">
|
||||
<span class='line'>295</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Property "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" nor an equivalent seems to exist"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>296</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>297</span> </span><span class="WHIT">
|
||||
<span class='line'>298</span> </span><span class="COMM">// --------------------------------------------------------------------------</span><span class="WHIT">
|
||||
<span class='line'>299</span>
|
||||
<span class='line'>300</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>301</span> * DOM
|
||||
<span class='line'>302</span> *
|
||||
<span class='line'>303</span> * Dom manipulation module
|
||||
<span class='line'>304</span> * @namespace
|
||||
<span class='line'>305</span> * @memberOf $_
|
||||
<span class='line'>306</span> * @name dom
|
||||
<span class='line'>307</span> */</span><span class="WHIT">
|
||||
<span class='line'>308</span> </span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>309</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>310</span> * Adds a class to the element(s) specified by the current
|
||||
<span class='line'>311</span> * selector
|
||||
<span class='line'>312</span> *
|
||||
<span class='line'>313</span> * @name addClass
|
||||
<span class='line'>314</span> * @memberOf $_.dom
|
||||
<span class='line'>315</span> * @function
|
||||
<span class='line'>316</span> * @param string class
|
||||
<span class='line'>317</span> */</span><span class="WHIT">
|
||||
<span class='line'>318</span> </span><span class="WHIT"> </span><span class="NAME">addClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>319</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>320</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>321</span> </span><span class="WHIT"> </span><span class="NAME">e.classList.add</span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>322</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>323</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>324</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>325</span> * Removes a class from the element(s) specified by the current
|
||||
<span class='line'>326</span> * selector
|
||||
<span class='line'>327</span> *
|
||||
<span class='line'>328</span> * @name prepend
|
||||
<span class='line'>328</span> * @name removeClass
|
||||
<span class='line'>329</span> * @memberOf $_.dom
|
||||
<span class='line'>330</span> * @function
|
||||
<span class='line'>331</span> * @param string htm
|
||||
<span class='line'>331</span> * @param string class
|
||||
<span class='line'>332</span> */</span><span class="WHIT">
|
||||
<span class='line'>333</span> </span><span class="WHIT"> </span><span class="NAME">prepend</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>334</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>335</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">document.insertAdjacentHTML</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'>336</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>337</span> </span><span class="WHIT"> </span><span class="NAME">this.el.insertAdjacentHTML</span><span class="PUNC">(</span><span class="STRN">'afterbegin'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>338</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>339</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||
<span class='line'>340</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>341</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>342</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>343</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>344</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>345</span> * Sets or gets the innerHTML propery of the element(s) passed
|
||||
<span class='line'>346</span> *
|
||||
<span class='line'>347</span> * @name html
|
||||
<span class='line'>348</span> * @memberOf $_.dom
|
||||
<span class='line'>349</span> * @function
|
||||
<span class='line'>350</span> * @param [string] htm
|
||||
<span class='line'>351</span> * @return string
|
||||
<span class='line'>352</span> * @type string
|
||||
<span class='line'>353</span> */</span><span class="WHIT">
|
||||
<span class='line'>354</span> </span><span class="WHIT"> </span><span class="NAME">html</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>355</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>356</span> </span><span class="WHIT">
|
||||
<span class='line'>357</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">htm</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'>358</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>359</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>360</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>361</span> </span><span class="WHIT">
|
||||
<span class='line'>362</span> </span><span class="COMM">//If the parameter is undefined, just return the current value</span><span class="WHIT">
|
||||
<span class='line'>363</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>364</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>365</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>366</span>
|
||||
<span class='line'>367</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'dom'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>368</span> </span><span class="WHIT">
|
||||
<span class='line'>369</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>370</span> </span></pre></body></html>
|
||||
<span class='line'>333</span> </span><span class="WHIT"> </span><span class="NAME">removeClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>334</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>335</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>336</span> </span><span class="WHIT"> </span><span class="NAME">e.classList.remove</span><span class="PUNC">(</span><span class="NAME">c</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>337</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>338</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>339</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>340</span> * Hides the element(s) specified by the current selector
|
||||
<span class='line'>341</span> *
|
||||
<span class='line'>342</span> * @name hide
|
||||
<span class='line'>343</span> * @memberOf $_.dom
|
||||
<span class='line'>344</span> * @function
|
||||
<span class='line'>345</span> */</span><span class="WHIT">
|
||||
<span class='line'>346</span> </span><span class="WHIT"> </span><span class="NAME">hide</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>347</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>348</span> </span><span class="WHIT"> </span><span class="NAME">this.css</span><span class="PUNC">(</span><span class="STRN">'display'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'none'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>349</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>350</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>351</span> * Shows the element(s) specified by the current selector.
|
||||
<span class='line'>352</span> * if type is specified, the element will have it's style
|
||||
<span class='line'>353</span> * property set to "display:[your type]". If type is not
|
||||
<span class='line'>354</span> * specified, the element is set to "display:block".
|
||||
<span class='line'>355</span> *
|
||||
<span class='line'>356</span> * @name show
|
||||
<span class='line'>357</span> * @memberOf $_.dom
|
||||
<span class='line'>358</span> * @function
|
||||
<span class='line'>359</span> * @param [string] type
|
||||
<span class='line'>360</span> */</span><span class="WHIT">
|
||||
<span class='line'>361</span> </span><span class="WHIT"> </span><span class="NAME">show</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>362</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>363</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">type</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'>364</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>365</span> </span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"block"</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>366</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>367</span>
|
||||
<span class='line'>368</span> </span><span class="WHIT"> </span><span class="NAME">this.css</span><span class="PUNC">(</span><span class="STRN">"display"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>369</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>370</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>371</span> * Sets attributes on element(s) specified by the current
|
||||
<span class='line'>372</span> * selector, or, if name is not specified, returns the
|
||||
<span class='line'>373</span> * value of the attribute of the element specified by the
|
||||
<span class='line'>374</span> * current selector.
|
||||
<span class='line'>375</span> *
|
||||
<span class='line'>376</span> * @name attr
|
||||
<span class='line'>377</span> * @memberOf $_.dom
|
||||
<span class='line'>378</span> * @function
|
||||
<span class='line'>379</span> * @param string name
|
||||
<span class='line'>380</span> * @param [string] value
|
||||
<span class='line'>381</span> * @return string
|
||||
<span class='line'>382</span> * @type string
|
||||
<span class='line'>383</span> */</span><span class="WHIT">
|
||||
<span class='line'>384</span> </span><span class="WHIT"> </span><span class="NAME">attr</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>385</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>386</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.el</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>387</span>
|
||||
<span class='line'>388</span> </span><span class="WHIT"> </span><span class="COMM">//Make sure you don't try to get a bunch of elements</span><span class="WHIT">
|
||||
<span class='line'>389</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</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'>390</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>391</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>392</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"Must be a singular element"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>393</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>394</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>395</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">sel.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</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><span class="COMM">//You can set a bunch, though</span><span class="WHIT">
|
||||
<span class='line'>396</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>397</span> </span><span class="WHIT"> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>398</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_attr</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>399</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>400</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>401</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="COMM">//Normal behavior</span><span class="WHIT">
|
||||
<span class='line'>402</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>403</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_attr</span><span class="PUNC">(</span><span class="NAME">sel</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>404</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>405</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>406</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>407</span> * Sets or retrieves the text content of the element
|
||||
<span class='line'>408</span> * specified by the current selector. If a value is
|
||||
<span class='line'>409</span> * passed, it will set that value on the current element,
|
||||
<span class='line'>410</span> * otherwise it will return the value of the current element
|
||||
<span class='line'>411</span> *
|
||||
<span class='line'>412</span> * @name text
|
||||
<span class='line'>413</span> * @memberOf $_.dom
|
||||
<span class='line'>414</span> * @function
|
||||
<span class='line'>415</span> * @param [string] value
|
||||
<span class='line'>416</span> * @return string
|
||||
<span class='line'>417</span> * @type string
|
||||
<span class='line'>418</span> */</span><span class="WHIT">
|
||||
<span class='line'>419</span> </span><span class="WHIT"> </span><span class="NAME">text</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>420</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>421</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">oldValue</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">set</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>422</span> </span><span class="WHIT">
|
||||
<span class='line'>423</span> </span><span class="NAME">sel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.el</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>424</span> </span><span class="WHIT">
|
||||
<span class='line'>425</span> </span><span class="NAME">set</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">value</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><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>426</span> </span><span class="WHIT">
|
||||
<span class='line'>427</span> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.innerText</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'>428</span> </span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"innerText"</span><span class="WHIT">
|
||||
<span class='line'>429</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">sel.textContent</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'>430</span> </span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"textContent"</span><span class="WHIT">
|
||||
<span class='line'>431</span> </span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"innerHTML"</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>432</span>
|
||||
<span class='line'>433</span> </span><span class="WHIT"> </span><span class="NAME">oldValue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>434</span> </span><span class="WHIT">
|
||||
<span class='line'>435</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">set</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>436</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>437</span> </span><span class="WHIT"> </span><span class="NAME">sel</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>438</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>439</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>440</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||
<span class='line'>441</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>442</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">oldValue</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>443</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>444</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>445</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>446</span> * Sets or retrieves a css property of the element
|
||||
<span class='line'>447</span> * specified by the current selector. If a value is
|
||||
<span class='line'>448</span> * passed, it will set that value on the current element,
|
||||
<span class='line'>449</span> * otherwise it will return the value of the css property
|
||||
<span class='line'>450</span> * on the current element
|
||||
<span class='line'>451</span> *
|
||||
<span class='line'>452</span> * @name css
|
||||
<span class='line'>453</span> * @memberOf $_.dom
|
||||
<span class='line'>454</span> * @function
|
||||
<span class='line'>455</span> * @param string property
|
||||
<span class='line'>456</span> * @param [string] value
|
||||
<span class='line'>457</span> * @return string
|
||||
<span class='line'>458</span> * @type string
|
||||
<span class='line'>459</span> */</span><span class="WHIT">
|
||||
<span class='line'>460</span> </span><span class="WHIT"> </span><span class="NAME">css</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">prop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>461</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>462</span> </span><span class="WHIT"> </span><span class="COMM">//Return the current value if a value is not set</span><span class="WHIT">
|
||||
<span class='line'>463</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">val</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'>464</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>465</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">this.el</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>466</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>467</span> </span><span class="WHIT">
|
||||
<span class='line'>468</span> </span><span class="NAME">$_.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>469</span> </span><span class="WHIT"> </span><span class="NAME">_css</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>470</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>471</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>472</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>473</span> * Adds to the innerHTML of the current element, after the last child.
|
||||
<span class='line'>474</span> *
|
||||
<span class='line'>475</span> * @example $_("ul").dom.append("<li></li>") adds an li element to the end of the selected ul element
|
||||
<span class='line'>476</span> * @name append
|
||||
<span class='line'>477</span> * @memberOf $_.dom
|
||||
<span class='line'>478</span> * @function
|
||||
<span class='line'>479</span> * @param string htm
|
||||
<span class='line'>480</span> */</span><span class="WHIT">
|
||||
<span class='line'>481</span> </span><span class="WHIT"> </span><span class="NAME">append</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>482</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>483</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">document.insertAdjacentHTML</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'>484</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>485</span> </span><span class="WHIT"> </span><span class="NAME">this.el.insertAdjacentHTML</span><span class="PUNC">(</span><span class="STRN">'beforeend'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>486</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>487</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||
<span class='line'>488</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>489</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>490</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>491</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>492</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>493</span> * Adds to the innerHTML of the selected element, before the current children
|
||||
<span class='line'>494</span> *
|
||||
<span class='line'>495</span> * @name prepend
|
||||
<span class='line'>496</span> * @memberOf $_.dom
|
||||
<span class='line'>497</span> * @function
|
||||
<span class='line'>498</span> * @param string htm
|
||||
<span class='line'>499</span> */</span><span class="WHIT">
|
||||
<span class='line'>500</span> </span><span class="WHIT"> </span><span class="NAME">prepend</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>501</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>502</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">document.insertAdjacentHTML</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'>503</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>504</span> </span><span class="WHIT"> </span><span class="NAME">this.el.insertAdjacentHTML</span><span class="PUNC">(</span><span class="STRN">'afterbegin'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>505</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>506</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
|
||||
<span class='line'>507</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>508</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>509</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>510</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
|
||||
<span class='line'>511</span> </span><span class="WHIT"> </span><span class="COMM">/**
|
||||
<span class='line'>512</span> * Sets or gets the innerHTML propery of the element(s) passed
|
||||
<span class='line'>513</span> *
|
||||
<span class='line'>514</span> * @name html
|
||||
<span class='line'>515</span> * @memberOf $_.dom
|
||||
<span class='line'>516</span> * @function
|
||||
<span class='line'>517</span> * @param [string] htm
|
||||
<span class='line'>518</span> * @return string
|
||||
<span class='line'>519</span> * @type string
|
||||
<span class='line'>520</span> */</span><span class="WHIT">
|
||||
<span class='line'>521</span> </span><span class="WHIT"> </span><span class="NAME">html</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT">
|
||||
<span class='line'>522</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>523</span> </span><span class="WHIT">
|
||||
<span class='line'>524</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">htm</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'>525</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
|
||||
<span class='line'>526</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>527</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>528</span> </span><span class="WHIT">
|
||||
<span class='line'>529</span> </span><span class="COMM">//If the parameter is undefined, just return the current value</span><span class="WHIT">
|
||||
<span class='line'>530</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>531</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
|
||||
<span class='line'>532</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>533</span>
|
||||
<span class='line'>534</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'dom'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>535</span> </span><span class="WHIT">
|
||||
<span class='line'>536</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
|
||||
<span class='line'>537</span> </span></pre></body></html>
|
0
docs/symbols/src/kis-js_src_modules_ajax.js.html
Normal file → Executable file
0
docs/symbols/src/kis-js_src_modules_event.js.html
Normal file → Executable file
0
docs/symbols/src/kis-js_src_modules_store.js.html
Normal file → Executable file
0
docs/symbols/src/kis-js_src_modules_template.js.html
Normal file → Executable file
0
docs/symbols/src/kis-js_src_modules_util.js.html
Normal file → Executable file
0
docs/ui.js
Normal file → Executable file
338
kis-all.js
@ -242,176 +242,7 @@
|
||||
return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
|
||||
};
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//This is used so IE 8 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));
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@ -434,6 +265,173 @@
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//This is used so IE 8 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));
|
||||
}
|
||||
|
||||
/**
|
||||
* DOM
|
||||
*
|
||||
|
338
kis-lite-dom-min.js
vendored
Normal file → Executable file
@ -242,176 +242,7 @@
|
||||
return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
|
||||
};
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//This is used so IE 8 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));
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@ -806,6 +637,173 @@
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//This is used so IE 8 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));
|
||||
}
|
||||
|
||||
/**
|
||||
* DOM
|
||||
*
|
||||
|
338
kis-lite-dom.js
Normal file → Executable file
@ -242,176 +242,7 @@
|
||||
return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
|
||||
};
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//This is used so IE 8 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));
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@ -806,6 +637,173 @@
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//This is used so IE 8 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));
|
||||
}
|
||||
|
||||
/**
|
||||
* DOM
|
||||
*
|
||||
|
21
kis-lite-min.js
vendored
Normal file → Executable file
@ -1,12 +1,9 @@
|
||||
(function(){if("undefined"!==typeof document.querySelector){var d,g,f,e;d=function(a){e="undefined"===typeof a?"undefined"!==typeof d.el?d.el:document.documentElement:"object"!==typeof a?g(a):a;d.prototype.el=e;var a=f(d),b;for(b in a)if("object"===typeof a[b])a[b].el=e;a.el=e;return a};g=function(a,b){var c;if("string"!=typeof a||"undefined"===typeof a)return a;c=null!=b&&1===b.nodeType?b:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);c=c.querySelectorAll(a);
|
||||
return 1===c.length?c[0]:c};f=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,b){b.el=e;d[a]=b};d.ext("each",function(a){if("undefined"!==typeof e.length&&e!==window){var b=e.length;if(0!==b)for(var c,h=0;h<b;h++)c=e.item(h)?e.item(h):e[h],a.call(c,c)}else a.call(e,e)});d.type=function(a){return function(){return a&&a!==this}.call(a)?
|
||||
(typeof a).toLowerCase():{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};d=window.$_=window.$_||d;d.$=g}})();
|
||||
(function(){if("undefined"===typeof window.console)window.console={log:function(){}};if("undefined"===typeof String.prototype.trim)String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(d){var d=(d.HTMLElement||d.Element).prototype,g=Object,f=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},e=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in
|
||||
this&&this[b]===a)return b;return-1},a=function(a,b){this.name=a;this.code=DOMException[a];this.message=b},b=function(b,c){if(""===c)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(c))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return e.call(b,c)},c=function(a){for(var b=f.call(a.className),b=b?b.split(/\s+/):[],c=0,e=b.length;c<e;c++)this.push(b[c]);this._updateClassName=function(){a.className=this.toString()}},h=c.prototype=[],
|
||||
i=function(){return new c(this)};a.prototype=Error.prototype;h.item=function(a){return this[a]||null};h.contains=function(a){return-1!==b(this,a+"")};h.add=function(a){a+="";-1===b(this,a)&&(this.push(a),this._updateClassName())};h.remove=function(a){a=b(this,a+"");-1!==a&&(this.splice(a,1),this._updateClassName())};h.toggle=function(a){a+="";-1===b(this,a)?this.add(a):this.remove(a)};h.toString=function(){return this.join(" ")};if(g.defineProperty){h={get:i,enumerable:!0,configurable:!0};try{g.defineProperty(d,
|
||||
"classList",h)}catch(j){if(-2146823252===j.number)h.enumerable=!1,g.defineProperty(d,"classList",h)}}else g.prototype.__defineGetter__&&d.__defineGetter__("classList",i)}(self);if("undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event)Event.prototype.preventDefault=function(){window.event.stop()},Event.prototype.stopPropagation=function(){window.event.returnValue=!1}})();
|
||||
(function(){if("undefined"!==typeof window.XMLHttpRequest){var d={_do:function(d,f,e,a){var b=new XMLHttpRequest;"undefined"===typeof e&&(e=function(){});a=a?"POST":"GET";d+="GET"===a?"?"+this._serialize(f):"";b.open(a,d);b.onreadystatechange=function(){4===b.readyState&&e(b.responseText)};"POST"===a?(b.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),b.send(this._serialize(f))):b.send(null)},_serialize:function(d){var f,e,a=[];for(f in d)d.hasOwnProperty(f)&&"function"!==typeof d[f]&&
|
||||
(e=d[f].toString(),f=encodeURIComponent(f),e=encodeURIComponent(e),a.push(f+"="+e));return a.join("&")}};$_.ext("get",function(g,f,e){d._do(g,f,e,!1)});$_.ext("post",function(g,f,e){d._do(g,f,e,!0)})}})();
|
||||
(function(){var d,g,f,e;"undefined"!==typeof document.addEventListener?(d=function(a,b,c){"undefined"!==typeof a.addEventListener&&a.addEventListener(b,c,!1)},g=function(a,b,c){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(b,c,!1)}):"undefined"!==typeof document.attachEvent&&(d=function(a,b,c){var h;function d(a){c.apply(a)}"undefined"!==typeof a.attachEvent?(g(b,c),a.attachEvent("on"+b,d),h=a.KIS_0_5_0=a.KIS_0_5_0||{},a=h,a.listeners=a.listeners||{},a.listeners[b]=a.listeners[b]||
|
||||
[],a.listeners[b].push({callback:c,_listener:d})):console.log("Failed to _attach event:"+b+" on "+a)},g=function(a,b,c){if("undefined"!==typeof a.detachEvent){var d=a.KIS_0_5_0;if(d&&d.listeners&&d.listeners[b])for(var e=d.listeners[b],f=e.length,g=0;g<f;g++)if(e[g].callback===c){a.detachEvent("on"+b,e[g]._listener);e.splice(g,1);0===e.length&&delete d.listeners[b];break}}});f=function(a,b,c,e){var i,j;if("undefined"===typeof a)return console.log(arguments),console.log(b),!1;if(b.match(/^([\w\-]+)$/))!0===
|
||||
e?d(a,b,c):g(a,b,c);else{b=b.split(" ");j=b.length;for(i=0;i<j;i++)f(a,b[i],c,e)}};e=function(a,b,c,d){f(a,c,function(a){var c,e,f,a=a||window.event;e=$_.$(b);for(c in e)f=a.target||a.srcElement,f==e[c]&&(d.call(e[c],a),a.stopPropagation())},!0)};$_.ext("event",{add:function(a,b){$_.each(function(c){f(c,a,b,!0)})},remove:function(a,b){$_.each(function(c){f(c,a,b,!1)})},live:function(a,b,c){e(document.documentElement,a,b,c)},delegate:function(a,b,c){$_.each(function(d){e(d,a,b,c)})}})})();
|
||||
(function(){if("undefined"!==typeof document.querySelector){var e,f,d,c;e=function(a){c="undefined"===typeof a?"undefined"!==typeof e.el?e.el:document.documentElement:"object"!==typeof a?f(a):a;e.prototype.el=c;var a=d(e),b;for(b in a)if("object"===typeof a[b])a[b].el=c;a.el=c;return a};f=function(a,b){var g;if("string"!=typeof a||"undefined"===typeof a)return a;g=null!=b&&1===b.nodeType?b:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);g=g.querySelectorAll(a);
|
||||
return 1===g.length?g[0]:g};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}};e.ext=function(a,b){b.el=c;e[a]=b};e.ext("each",function(a){if("undefined"!==typeof c.length&&c!==window){var b=c.length;if(0!==b)for(var g,d=0;d<b;d++)g=c.item(d)?c.item(d):c[d],a.call(g,g)}else a.call(c,c)});e.type=function(a){return function(){return a&&a!==this}.call(a)?
|
||||
(typeof a).toLowerCase():{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};e=window.$_=window.$_||e;e.$=f}})();
|
||||
(function(){if("undefined"===typeof window.console)window.console={log:function(){}};if("undefined"===typeof String.prototype.trim)String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};if("undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event)Event.prototype.preventDefault=function(){window.event.stop()},Event.prototype.stopPropagation=function(){window.event.returnValue=!1}})();
|
||||
(function(){if("undefined"!==typeof window.XMLHttpRequest){var e={_do:function(f,d,c,a){var b=new XMLHttpRequest;"undefined"===typeof c&&(c=function(){});a=a?"POST":"GET";f+="GET"===a?"?"+this._serialize(d):"";b.open(a,f);b.onreadystatechange=function(){4===b.readyState&&c(b.responseText)};"POST"===a?(b.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),b.send(this._serialize(d))):b.send(null)},_serialize:function(f){var d,c,a=[];for(d in f)f.hasOwnProperty(d)&&"function"!==typeof f[d]&&
|
||||
(c=f[d].toString(),d=encodeURIComponent(d),c=encodeURIComponent(c),a.push(d+"="+c));return a.join("&")}};$_.ext("get",function(f,d,c){e._do(f,d,c,!1)});$_.ext("post",function(f,d,c){e._do(f,d,c,!0)})}})();
|
||||
(function(){var e,f,d,c;"undefined"!==typeof document.addEventListener?(e=function(a,b,g){"undefined"!==typeof a.addEventListener&&a.addEventListener(b,g,!1)},f=function(a,b,g){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(b,g,!1)}):"undefined"!==typeof document.attachEvent&&(e=function(a,b,g){var h;function c(a){g.apply(a)}"undefined"!==typeof a.attachEvent?(f(b,g),a.attachEvent("on"+b,c),h=a.KIS_0_5_0=a.KIS_0_5_0||{},a=h,a.listeners=a.listeners||{},a.listeners[b]=a.listeners[b]||
|
||||
[],a.listeners[b].push({callback:g,_listener:c})):console.log("Failed to _attach event:"+b+" on "+a)},f=function(a,b,g){if("undefined"!==typeof a.detachEvent){var c=a.KIS_0_5_0;if(c&&c.listeners&&c.listeners[b])for(var d=c.listeners[b],f=d.length,e=0;e<f;e++)if(d[e].callback===g){a.detachEvent("on"+b,d[e]._listener);d.splice(e,1);0===d.length&&delete c.listeners[b];break}}});d=function(a,b,c,i){var h,j;if("undefined"===typeof a)return console.log(arguments),console.log(b),!1;if(b.match(/^([\w\-]+)$/))!0===
|
||||
i?e(a,b,c):f(a,b,c);else{b=b.split(" ");j=b.length;for(h=0;h<j;h++)d(a,b[h],c,i)}};c=function(a,b,c,e){d(a,c,function(a){var c,d,g,a=a||window.event;d=$_.$(b);for(c in d)g=a.target||a.srcElement,g==d[c]&&(e.call(d[c],a),a.stopPropagation())},!0)};$_.ext("event",{add:function(a,b){$_.each(function(c){d(c,a,b,!0)})},remove:function(a,b){$_.each(function(c){d(c,a,b,!1)})},live:function(a,b,d){c(document.documentElement,a,b,d)},delegate:function(a,b,d){$_.each(function(e){c(e,a,b,d)})}})})();
|
||||
|
171
kis-lite.js
Normal file → Executable file
@ -242,176 +242,7 @@
|
||||
return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
|
||||
};
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//This is used so IE 8 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));
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
8
kis-min.js
vendored
@ -1,10 +1,10 @@
|
||||
(function(){if("undefined"!==typeof document.querySelector){var g,f,d,b;g=function(a){b="undefined"===typeof a?"undefined"!==typeof g.el?g.el:document.documentElement:"object"!==typeof a?f(a):a;g.prototype.el=b;var a=d(g),c;for(c in a)if("object"===typeof a[c])a[c].el=b;a.el=b;return a};f=function(a,c){var b;if("string"!=typeof a||"undefined"===typeof a)return a;b=null!=c&&1===c.nodeType?c:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=b.querySelectorAll(a);
|
||||
return 1===b.length?b[0]:b};d=function(a){var c;if("undefined"!==typeof a){if("undefined"!==typeof Object.create)return Object.create(a);c=typeof a;if(!("object"!==c&&"function"!==c))return c=function(){},c.prototype=a,new c}};g.ext=function(a,c){c.el=b;g[a]=c};g.ext("each",function(a){if("undefined"!==typeof b.length&&b!==window){var c=b.length;if(0!==c)for(var e,d=0;d<c;d++)e=b.item(d)?b.item(d):b[d],a.call(e,e)}else a.call(b,b)});g.type=function(a){return function(){return a&&a!==this}.call(a)?
|
||||
(typeof a).toLowerCase():{}.toString.call(a).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};g=window.$_=window.$_||g;g.$=f}})();
|
||||
(function(){if("undefined"===typeof window.console)window.console={log:function(){}};if("undefined"===typeof String.prototype.trim)String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(g){var g=(g.HTMLElement||g.Element).prototype,f=Object,d=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},b=Array.prototype.indexOf||function(a){for(var c=0,b=this.length;c<b;c++)if(c in
|
||||
this&&this[c]===a)return c;return-1},a=function(a,c){this.name=a;this.code=DOMException[a];this.message=c},c=function(c,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR","String contains an invalid character");return b.call(c,e)},e=function(a){for(var c=d.call(a.className),c=c?c.split(/\s+/):[],b=0,e=c.length;b<e;b++)this.push(c[b]);this._updateClassName=function(){a.className=this.toString()}},j=e.prototype=[],
|
||||
h=function(){return new e(this)};a.prototype=Error.prototype;j.item=function(a){return this[a]||null};j.contains=function(a){return-1!==c(this,a+"")};j.add=function(a){a+="";-1===c(this,a)&&(this.push(a),this._updateClassName())};j.remove=function(a){a=c(this,a+"");-1!==a&&(this.splice(a,1),this._updateClassName())};j.toggle=function(a){a+="";-1===c(this,a)?this.add(a):this.remove(a)};j.toString=function(){return this.join(" ")};if(f.defineProperty){j={get:h,enumerable:!0,configurable:!0};try{f.defineProperty(g,
|
||||
"classList",j)}catch(i){if(-2146823252===i.number)j.enumerable=!1,f.defineProperty(g,"classList",j)}}else f.prototype.__defineGetter__&&g.__defineGetter__("classList",h)}(self);if("undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event)Event.prototype.preventDefault=function(){window.event.stop()},Event.prototype.stopPropagation=function(){window.event.returnValue=!1}})();
|
||||
(function(){if("undefined"===typeof window.console)window.console={log:function(){}};if("undefined"===typeof String.prototype.trim)String.prototype.trim=function(){return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g,"")};if("undefined"===typeof Event.preventDefault&&"undefined"!==typeof window.event)Event.prototype.preventDefault=function(){window.event.stop()},Event.prototype.stopPropagation=function(){window.event.returnValue=!1}})();
|
||||
"undefined"!==typeof document&&!("classList"in document.createElement("a"))&&function(g){var g=(g.HTMLElement||g.Element).prototype,f=Object,d=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},b=Array.prototype.indexOf||function(a){for(var c=0,b=this.length;c<b;c++)if(c in this&&this[c]===a)return c;return-1},a=function(a,c){this.name=a;this.code=DOMException[a];this.message=c},c=function(c,e){if(""===e)throw new a("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(e))throw new a("INVALID_CHARACTER_ERR",
|
||||
"String contains an invalid character");return b.call(c,e)},e=function(a){for(var c=d.call(a.className),c=c?c.split(/\s+/):[],b=0,e=c.length;b<e;b++)this.push(c[b]);this._updateClassName=function(){a.className=this.toString()}},j=e.prototype=[],h=function(){return new e(this)};a.prototype=Error.prototype;j.item=function(a){return this[a]||null};j.contains=function(a){return-1!==c(this,a+"")};j.add=function(a){a+="";-1===c(this,a)&&(this.push(a),this._updateClassName())};j.remove=function(a){a=c(this,
|
||||
a+"");-1!==a&&(this.splice(a,1),this._updateClassName())};j.toggle=function(a){a+="";-1===c(this,a)?this.add(a):this.remove(a)};j.toString=function(){return this.join(" ")};if(f.defineProperty){j={get:h,enumerable:!0,configurable:!0};try{f.defineProperty(g,"classList",j)}catch(i){if(-2146823252===i.number)j.enumerable=!1,f.defineProperty(g,"classList",j)}}else f.prototype.__defineGetter__&&g.__defineGetter__("classList",h)}(self);
|
||||
(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<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,
|
||||
|
0
src/core.js
Normal file → Executable file
167
src/modules/DOM.js
Normal file → Executable file
@ -1,3 +1,170 @@
|
||||
//This is used so IE 8 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));
|
||||
}
|
||||
|
||||
/**
|
||||
* DOM
|
||||
*
|
||||
|
0
src/modules/ajax.js
Normal file → Executable file
0
src/modules/event.js
Normal file → Executable file
0
src/modules/store.js
Normal file → Executable file
0
src/modules/template.js
Normal file → Executable file
0
src/modules/util.js
Normal file → Executable file
171
src/polyfill.js
Normal file → Executable file
@ -29,176 +29,7 @@
|
||||
return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
|
||||
};
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//This is used so IE 8 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));
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
|