Simplify and cleanup event and dom modules, add context option to main constructor
This commit is contained in:
parent
8e9d93a525
commit
3ef9e89ab6
@ -68,7 +68,7 @@ Dom manipulation module</div>
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line101">line 101</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line81">line 81</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -97,12 +97,14 @@ Dom manipulation module</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3 class="subsection-title">Methods</h3>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="addClass"><span class="type-signature"><static> </span>addClass<span class="signature">(class)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="addClass"><span class="type-signature">(static) </span>addClass<span class="signature">(class)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -192,7 +194,7 @@ selector
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line110">line 110</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line90">line 90</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -222,7 +224,7 @@ selector
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="append"><span class="type-signature"><static> </span>append<span class="signature">(htm)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="append"><span class="type-signature">(static) </span>append<span class="signature">(htm)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -311,7 +313,7 @@ selector
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line279">line 279</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line256">line 256</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -346,7 +348,7 @@ selector
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="attr"><span class="type-signature"><static> </span>attr<span class="signature">(name, <span class="optional">value</span>)</span><span class="type-signature"> → {string}</span></h4>
|
||||
<h4 class="name" id="attr"><span class="type-signature">(static) </span>attr<span class="signature">(name, value<span class="signature-attributes">opt, nullable</span>)</span><span class="type-signature"> → (nullable) {string}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -379,7 +381,7 @@ current selector.
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
@ -483,7 +485,7 @@ current selector.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line171">line 171</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line151">line 151</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -531,7 +533,7 @@ current selector.
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="css"><span class="type-signature"><static> </span>css<span class="signature">(property, <span class="optional">value</span>)</span><span class="type-signature"> → {string}</span></h4>
|
||||
<h4 class="name" id="css"><span class="type-signature">(static) </span>css<span class="signature">(property, value<span class="signature-attributes">opt, nullable</span>)</span><span class="type-signature"> → (nullable) {string}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -568,7 +570,7 @@ multiple key/value pairs.
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
@ -675,7 +677,7 @@ multiple key/value pairs.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line236">line 236</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line216">line 216</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -723,7 +725,7 @@ multiple key/value pairs.
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="hide"><span class="type-signature"><static> </span>hide<span class="signature">()</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="hide"><span class="type-signature">(static) </span>hide<span class="signature">()</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -764,7 +766,7 @@ multiple key/value pairs.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line140">line 140</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line120">line 120</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -794,7 +796,7 @@ multiple key/value pairs.
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="html"><span class="type-signature"><static> </span>html<span class="signature">(<span class="optional">htm</span>)</span><span class="type-signature"> → {string}</span></h4>
|
||||
<h4 class="name" id="html"><span class="type-signature">(static) </span>html<span class="signature">(htm<span class="signature-attributes">opt, nullable</span>)</span><span class="type-signature"> → (nullable) {string}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -824,7 +826,7 @@ multiple key/value pairs.
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
@ -897,7 +899,7 @@ multiple key/value pairs.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line304">line 304</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line281">line 281</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -945,7 +947,7 @@ multiple key/value pairs.
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="prepend"><span class="type-signature"><static> </span>prepend<span class="signature">(htm)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="prepend"><span class="type-signature">(static) </span>prepend<span class="signature">(htm)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -1034,7 +1036,7 @@ multiple key/value pairs.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line292">line 292</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line269">line 269</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1064,7 +1066,7 @@ multiple key/value pairs.
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="removeClass"><span class="type-signature"><static> </span>removeClass<span class="signature">(class)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="removeClass"><span class="type-signature">(static) </span>removeClass<span class="signature">(class)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -1154,7 +1156,7 @@ selector
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line125">line 125</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line105">line 105</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1184,7 +1186,7 @@ selector
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="show"><span class="type-signature"><static> </span>show<span class="signature">(<span class="optional">type</span>)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="show"><span class="type-signature">(static) </span>show<span class="signature">(type<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -1217,7 +1219,7 @@ specified, the element is set to "display:block".
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
@ -1288,7 +1290,7 @@ specified, the element is set to "display:block".
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line151">line 151</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line131">line 131</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1318,7 +1320,7 @@ specified, the element is set to "display:block".
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="text"><span class="type-signature"><static> </span>text<span class="signature">(<span class="optional">value</span>)</span><span class="type-signature"> → {string}</span></h4>
|
||||
<h4 class="name" id="text"><span class="type-signature">(static) </span>text<span class="signature">(value<span class="signature-attributes">opt, nullable</span>)</span><span class="type-signature"> → (nullable) {string}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -1351,7 +1353,7 @@ otherwise it will return the value of the current element
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
@ -1424,7 +1426,7 @@ otherwise it will return the value of the current element
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line204">line 204</a>
|
||||
<a href="DOM.js.html">modules/DOM.js</a>, <a href="DOM.js.html#line184">line 184</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1485,13 +1487,13 @@ otherwise it will return the value of the current element
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -95,12 +95,14 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3 class="subsection-title">Methods</h3>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="add"><span class="type-signature"><static> </span>add<span class="signature">(event, callback)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="add"><span class="type-signature">(static) </span>add<span class="signature">(event, callback)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -213,7 +215,7 @@ event and selector
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="event.js.html">modules/event.js</a>, <a href="event.js.html#line104">line 104</a>
|
||||
<a href="event.js.html">modules/event.js</a>, <a href="event.js.html#line96">line 96</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -248,7 +250,7 @@ event and selector
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="create"><span class="type-signature"><static> </span>create<span class="signature">(name, <span class="optional">data</span>)</span><span class="type-signature"> → {Object}</span></h4>
|
||||
<h4 class="name" id="create"><span class="type-signature">(static) </span>create<span class="signature">(name, data<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Object}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -278,7 +280,7 @@ event and selector
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
@ -433,7 +435,7 @@ event and selector
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="delegate"><span class="type-signature"><static> </span>delegate<span class="signature">(target, event, callback)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="delegate"><span class="type-signature">(static) </span>delegate<span class="signature">(target, event, callback)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -568,7 +570,7 @@ event and selector
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="event.js.html">modules/event.js</a>, <a href="event.js.html#line152">line 152</a>
|
||||
<a href="event.js.html">modules/event.js</a>, <a href="event.js.html#line144">line 144</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -603,7 +605,7 @@ event and selector
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="live"><span class="type-signature"><static> </span>live<span class="signature">(target, event, callback)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="live"><span class="type-signature">(static) </span>live<span class="signature">(target, event, callback)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -738,7 +740,7 @@ event and selector
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="event.js.html">modules/event.js</a>, <a href="event.js.html#line137">line 137</a>
|
||||
<a href="event.js.html">modules/event.js</a>, <a href="event.js.html#line129">line 129</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -773,7 +775,7 @@ event and selector
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="remove"><span class="type-signature"><static> </span>remove<span class="signature">(event, callback)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="remove"><span class="type-signature">(static) </span>remove<span class="signature">(event, callback)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -885,7 +887,7 @@ event and selector
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="event.js.html">modules/event.js</a>, <a href="event.js.html#line121">line 121</a>
|
||||
<a href="event.js.html">modules/event.js</a>, <a href="event.js.html#line113">line 113</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -920,7 +922,7 @@ event and selector
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="trigger"><span class="type-signature"><static> </span>trigger<span class="signature">(event)</span><span class="type-signature"> → {boolean}</span></h4>
|
||||
<h4 class="name" id="trigger"><span class="type-signature">(static) </span>trigger<span class="signature">(event)</span><span class="type-signature"> → {boolean}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -1009,7 +1011,7 @@ event and selector
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="event.js.html">modules/event.js</a>, <a href="event.js.html#line169">line 169</a>
|
||||
<a href="event.js.html">modules/event.js</a>, <a href="event.js.html#line161">line 161</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -1075,13 +1077,13 @@ event and selector
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
24
docs/$_.html
24
docs/$_.html
@ -91,6 +91,8 @@ Constructor function</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3 class="subsection-title">Namespaces</h3>
|
||||
|
||||
<dl>
|
||||
@ -113,7 +115,7 @@ Constructor function</div>
|
||||
<dl>
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="$"><span class="type-signature"><static> </span>$<span class="signature">(selector, <span class="optional">context</span>)</span><span class="type-signature"> → {Object}</span></h4>
|
||||
<h4 class="name" id="$"><span class="type-signature">(static) </span>$<span class="signature">(selector, context<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Object}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -143,7 +145,7 @@ Constructor function</div>
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
@ -245,7 +247,7 @@ Constructor function</div>
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line67">line 67</a>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line68">line 68</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -293,7 +295,7 @@ Constructor function</div>
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="each"><span class="type-signature"><static> </span>each<span class="signature">(callback)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="each"><span class="type-signature">(static) </span>each<span class="signature">(callback)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -382,7 +384,7 @@ Constructor function</div>
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line104">line 104</a>
|
||||
<a href="core.js.html">core.js</a>, <a href="core.js.html#line105">line 105</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@ -412,7 +414,7 @@ Constructor function</div>
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="get"><span class="type-signature"><static> </span>get<span class="signature">(url, data, success_callback, <span class="optional">error_callback</span>)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="get"><span class="type-signature">(static) </span>get<span class="signature">(url, data, success_callback, error_callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -442,7 +444,7 @@ Constructor function</div>
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
@ -636,7 +638,7 @@ Constructor function</div>
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="post"><span class="type-signature"><static> </span>post<span class="signature">(url, data, success_callback, <span class="optional">error_callback</span>)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="post"><span class="type-signature">(static) </span>post<span class="signature">(url, data, success_callback, error_callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -666,7 +668,7 @@ Constructor function</div>
|
||||
<th>Type</th>
|
||||
|
||||
|
||||
<th>Argument</th>
|
||||
<th>Attributes</th>
|
||||
|
||||
|
||||
|
||||
@ -873,13 +875,13 @@ Constructor function</div>
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -97,12 +97,14 @@ to use sessionStorage rather than the default localStorage.</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3 class="subsection-title">Methods</h3>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="clear"><span class="type-signature"><static> </span>clear<span class="signature">(session)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="clear"><span class="type-signature">(static) </span>clear<span class="signature">(session)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -221,7 +223,7 @@ to use sessionStorage rather than the default localStorage.</div>
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="get"><span class="type-signature"><static> </span>get<span class="signature">(key, session)</span><span class="type-signature"> → {Object}</span></h4>
|
||||
<h4 class="name" id="get"><span class="type-signature">(static) </span>get<span class="signature">(key, session)</span><span class="type-signature"> → {Object}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -382,7 +384,7 @@ based on the specified key
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="getAll"><span class="type-signature"><static> </span>getAll<span class="signature">(session)</span><span class="type-signature"> → {Object}</span></h4>
|
||||
<h4 class="name" id="getAll"><span class="type-signature">(static) </span>getAll<span class="signature">(session)</span><span class="type-signature"> → {Object}</span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -519,7 +521,7 @@ based on the specified key
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="remove"><span class="type-signature"><static> </span>remove<span class="signature">(key, session)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="remove"><span class="type-signature">(static) </span>remove<span class="signature">(key, session)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -661,7 +663,7 @@ based on the specified key
|
||||
|
||||
|
||||
<dt>
|
||||
<h4 class="name" id="set"><span class="type-signature"><static> </span>set<span class="signature">(key, value, session)</span><span class="type-signature"></span></h4>
|
||||
<h4 class="name" id="set"><span class="type-signature">(static) </span>set<span class="signature">(key, value, session)</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
</dt>
|
||||
@ -840,13 +842,13 @@ and JSON-encodes the value if not a string
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -85,40 +85,20 @@
|
||||
|
||||
function _css(sel, prop, val)
|
||||
{
|
||||
var equi;
|
||||
|
||||
//Camel-case
|
||||
prop = _toCamel(prop);
|
||||
|
||||
//Equivalent properties for 'special' browsers
|
||||
equi = {
|
||||
outerHeight: "offsetHeight",
|
||||
outerWidth: "offsetWidth",
|
||||
top: "posTop"
|
||||
};
|
||||
|
||||
|
||||
//If you don't define a value, try returning the existing value
|
||||
if(val === undefined && sel.style[prop] !== undefined)
|
||||
{
|
||||
return sel.style[prop];
|
||||
}
|
||||
else if(val === undefined && sel.style[equi[prop]] !== undefined)
|
||||
{
|
||||
return sel.style[equi[prop]];
|
||||
}
|
||||
|
||||
//Let's try the easy way first
|
||||
// Let's set a value instead
|
||||
if(sel.style[prop] !== undefined)
|
||||
{
|
||||
sel.style[prop] = val;
|
||||
|
||||
//Short circuit
|
||||
return null;
|
||||
}
|
||||
else if(sel.style[equi[prop]])
|
||||
{
|
||||
sel.style[equi[prop]] = val;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -284,14 +264,11 @@
|
||||
// If passed an object, recurse!
|
||||
if($_.type(prop) === 'object')
|
||||
{
|
||||
for (prop_key in prop)
|
||||
{
|
||||
if ( ! prop.hasOwnProperty(prop_key)) continue;
|
||||
|
||||
Object.keys(prop).forEach(function(prop_key) {
|
||||
$_.each(function (e){
|
||||
_css(e, prop_key, prop[prop_key]);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//Return the current value if a value is not set
|
||||
else if(val === undefined && $_.type(prop) !== 'object')
|
||||
@ -362,13 +339,13 @@
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -160,13 +160,13 @@
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -46,9 +46,10 @@
|
||||
* @constructor
|
||||
* @namespace $_
|
||||
* @param {string} selector - The dom selector string
|
||||
* @param {Object} [context] - Context of the dom selector string
|
||||
* @return {Object}
|
||||
*/
|
||||
$_ = function(s)
|
||||
$_ = function(s, context)
|
||||
{
|
||||
// Have documentElement be default selector, just in case
|
||||
if (s === undefined)
|
||||
@ -60,7 +61,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
sel = $(s);
|
||||
sel = $(s, context);
|
||||
}
|
||||
|
||||
// Add the selector to the prototype
|
||||
@ -91,29 +92,29 @@
|
||||
* @param {Object} [context]
|
||||
* @return {Object}
|
||||
*/
|
||||
$ = function (a, context)
|
||||
$ = function (selector, context)
|
||||
{
|
||||
var x, c;
|
||||
var elements;
|
||||
|
||||
if (typeof a != "string" || a === undefined){ return a;}
|
||||
if (typeof selector != "string" || selector === undefined){ return selector;}
|
||||
|
||||
//Check for a context of a specific element, otherwise, just run on the document
|
||||
c = (context != null && context.nodeType === 1)
|
||||
context = (context != null && context.nodeType === 1)
|
||||
? context
|
||||
: document;
|
||||
|
||||
//Pick the quickest method for each kind of selector
|
||||
if (a.match(/^#([\w\-]+$)/))
|
||||
if (selector.match(/^#([\w\-]+$)/))
|
||||
{
|
||||
return document.getElementById(a.split('#')[1]);
|
||||
return document.getElementById(selector.split('#')[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = c.querySelectorAll(a);
|
||||
elements = context.querySelectorAll(selector);
|
||||
}
|
||||
|
||||
//Return the single object if applicable
|
||||
return (x.length === 1) ? x[0] : x;
|
||||
return (elements.length === 1) ? elements[0] : elements;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -179,13 +180,13 @@
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -112,21 +112,13 @@
|
||||
*/
|
||||
create: function(name, data)
|
||||
{
|
||||
// Do a terrible browser-sniffic hack because I don't know of a good
|
||||
// feature test
|
||||
if (/MSIE|Trident/i.test(navigator.userAgent))
|
||||
{
|
||||
data = data || {};
|
||||
|
||||
// Okay, I guess we have to do this the hard way... :(
|
||||
// Microsoft, your browser still sucks
|
||||
var e = document.createEvent('CustomEvent');
|
||||
e.initCustomEvent(name, true, true, data);
|
||||
|
||||
return e;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new CustomEvent(name, data);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Adds an event that returns a callback when triggered on the selected
|
||||
@ -222,13 +214,13 @@
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -168,7 +168,7 @@ Module for making ajax requests
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Wed Sep 10 2014 00:23:43 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -121,6 +121,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
</section>
|
||||
@ -131,13 +133,13 @@
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -28,12 +28,7 @@
|
||||
<pre class="prettyprint source linenums"><code>/**
|
||||
* A module of various browser polyfills
|
||||
* @file polyfill.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Promise.prototype.done polyfill
|
||||
*/
|
||||
if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this.then(cb, eb).then(null, function (err) { setTimeout(function () { throw err; }, 0); }); }; }</code></pre>
|
||||
*/</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
@ -43,13 +38,13 @@ if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -151,13 +151,13 @@
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul><h3>Global</h3><ul><li><a href="global.html#data[undefined]">data[undefined]</a></li></ul>
|
||||
<h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="$_.html">$_</a></li><li><a href="$_.dom.html">dom</a></li><li><a href="$_.event.html">event</a></li><li><a href="$_.store.html">store</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br clear="both">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Fri Sep 05 2014 11:56:00 GMT-0400 (EDT)
|
||||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Sep 12 2014 16:11:50 GMT-0400 (EDT)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
@ -58,8 +58,7 @@ section
|
||||
display: none;
|
||||
}
|
||||
|
||||
.optional:after {
|
||||
content: "opt";
|
||||
.signature-attributes {
|
||||
font-size: 60%;
|
||||
color: #aaa;
|
||||
font-style: italic;
|
||||
|
67
kis-all.js
67
kis-all.js
@ -19,9 +19,10 @@
|
||||
* @constructor
|
||||
* @namespace $_
|
||||
* @param {string} selector - The dom selector string
|
||||
* @param {Object} [context] - Context of the dom selector string
|
||||
* @return {Object}
|
||||
*/
|
||||
$_ = function(s)
|
||||
$_ = function(s, context)
|
||||
{
|
||||
// Have documentElement be default selector, just in case
|
||||
if (s === undefined)
|
||||
@ -33,7 +34,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
sel = $(s);
|
||||
sel = $(s, context);
|
||||
}
|
||||
|
||||
// Add the selector to the prototype
|
||||
@ -64,29 +65,29 @@
|
||||
* @param {Object} [context]
|
||||
* @return {Object}
|
||||
*/
|
||||
$ = function (a, context)
|
||||
$ = function (selector, context)
|
||||
{
|
||||
var x, c;
|
||||
var elements;
|
||||
|
||||
if (typeof a != "string" || a === undefined){ return a;}
|
||||
if (typeof selector != "string" || selector === undefined){ return selector;}
|
||||
|
||||
//Check for a context of a specific element, otherwise, just run on the document
|
||||
c = (context != null && context.nodeType === 1)
|
||||
context = (context != null && context.nodeType === 1)
|
||||
? context
|
||||
: document;
|
||||
|
||||
//Pick the quickest method for each kind of selector
|
||||
if (a.match(/^#([\w\-]+$)/))
|
||||
if (selector.match(/^#([\w\-]+$)/))
|
||||
{
|
||||
return document.getElementById(a.split('#')[1]);
|
||||
return document.getElementById(selector.split('#')[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = c.querySelectorAll(a);
|
||||
elements = context.querySelectorAll(selector);
|
||||
}
|
||||
|
||||
//Return the single object if applicable
|
||||
return (x.length === 1) ? x[0] : x;
|
||||
return (elements.length === 1) ? elements[0] : elements;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -151,11 +152,6 @@
|
||||
* @file polyfill.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Promise.prototype.done polyfill
|
||||
*/
|
||||
if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this.then(cb, eb).then(null, function (err) { setTimeout(function () { throw err; }, 0); }); }; }
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@ -224,40 +220,20 @@ if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this
|
||||
|
||||
function _css(sel, prop, val)
|
||||
{
|
||||
var equi;
|
||||
|
||||
//Camel-case
|
||||
prop = _toCamel(prop);
|
||||
|
||||
//Equivalent properties for 'special' browsers
|
||||
equi = {
|
||||
outerHeight: "offsetHeight",
|
||||
outerWidth: "offsetWidth",
|
||||
top: "posTop"
|
||||
};
|
||||
|
||||
|
||||
//If you don't define a value, try returning the existing value
|
||||
if(val === undefined && sel.style[prop] !== undefined)
|
||||
{
|
||||
return sel.style[prop];
|
||||
}
|
||||
else if(val === undefined && sel.style[equi[prop]] !== undefined)
|
||||
{
|
||||
return sel.style[equi[prop]];
|
||||
}
|
||||
|
||||
//Let's try the easy way first
|
||||
// Let's set a value instead
|
||||
if(sel.style[prop] !== undefined)
|
||||
{
|
||||
sel.style[prop] = val;
|
||||
|
||||
//Short circuit
|
||||
return null;
|
||||
}
|
||||
else if(sel.style[equi[prop]])
|
||||
{
|
||||
sel.style[equi[prop]] = val;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -423,14 +399,11 @@ if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this
|
||||
// If passed an object, recurse!
|
||||
if($_.type(prop) === 'object')
|
||||
{
|
||||
for (prop_key in prop)
|
||||
{
|
||||
if ( ! prop.hasOwnProperty(prop_key)) continue;
|
||||
|
||||
Object.keys(prop).forEach(function(prop_key) {
|
||||
$_.each(function (e){
|
||||
_css(e, prop_key, prop[prop_key]);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//Return the current value if a value is not set
|
||||
else if(val === undefined && $_.type(prop) !== 'object')
|
||||
@ -706,21 +679,13 @@ if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this
|
||||
*/
|
||||
create: function(name, data)
|
||||
{
|
||||
// Do a terrible browser-sniffic hack because I don't know of a good
|
||||
// feature test
|
||||
if (/MSIE|Trident/i.test(navigator.userAgent))
|
||||
{
|
||||
data = data || {};
|
||||
|
||||
// Okay, I guess we have to do this the hard way... :(
|
||||
// Microsoft, your browser still sucks
|
||||
var e = document.createEvent('CustomEvent');
|
||||
e.initCustomEvent(name, true, true, data);
|
||||
|
||||
return e;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new CustomEvent(name, data);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Adds an event that returns a callback when triggered on the selected
|
||||
|
18
kis-lite-dom-min.js
vendored
18
kis-lite-dom-min.js
vendored
@ -1,9 +1,9 @@
|
||||
(function(e){var c,h,b;c=function(a){b=a===e?c.el!==e?c.el:document.documentElement:h(a);c.prototype.el=b;a=Object.create(c);for(var d in a)"object"===typeof a[d]&&(a[d].el=b);a.el=b;return a};h=function(a,d){var b;if("string"!=typeof a||a===e)return a;b=null!=d&&1===d.nodeType?d:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=b.querySelectorAll(a);return 1===b.length?b[0]:b};c.ext=function(a,d){d.el=b;c[a]=d};c.ext("each",function(a){b.length!==e&&b!==window?
|
||||
[].forEach.call(b,a):a.call(b,b)});c.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()};c=window.$_=window.$_||c;c.$=h})();Promise.prototype.done||(Promise.prototype.done=function(e,c){this.then(e,c).then(null,function(e){setTimeout(function(){throw e;},0)})});
|
||||
(function(e){var c={_do:function(c,b,a,d,g){var f=new XMLHttpRequest;a===e&&(a=function(){});g=g?"POST":"GET";"GET"===g&&(c+=c.match(/\?/)?this._serialize(b):"?"+this._serialize(b));f.open(g,c);f.onreadystatechange=function(){4===f.readyState&&(200===f.status?a.call(f.responseText,f.responseText):d!==e&&d.call(f.status,f.status))};"POST"===g?(f.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),f.send(this._serialize(b))):f.send(null)},_serialize:function(c){var b,a,d=[];for(b in c)c.hasOwnProperty(b)&&
|
||||
"function"!==$_.type(c[b])&&(a=c[b].toString(),b=encodeURIComponent(b),a=encodeURIComponent(a),d.push(b+"="+a));return d.join("&")}};$_.ext("get",function(e,b,a,d){c._do(e,b,a,d,!1)});$_.ext("post",function(e,b,a,d){c._do(e,b,a,d,!0)})})();
|
||||
(function(e){var c,h;c=function(b,a,d,g){var f,e;if(a.match(/^([\w\-]+)$/))!0===g?b.addEventListener(a,d,!1):b.removeEventListener(a,d,!1);else for(a=a.split(" "),e=a.length,f=0;f<e;f++)c(b,a[f],d,g)};h=function(b,a,d,g){c(b,d,function(d){var e,c;c=$_.$(a,b);for(e in c)d.target==c[e]&&(g.call(c[e],d),d.stopPropagation())},!0)};$_.ext("event",{create:function(b,a){if(/MSIE|Trident/i.test(navigator.userAgent)){var d=document.createEvent("CustomEvent");d.initCustomEvent(b,!0,!0,a);return d}return new CustomEvent(b,
|
||||
a)},add:function(b,a){$_.each(function(d){c(d,b,a,!0)})},remove:function(b,a){$_.each(function(d){c(d,b,a,!1)})},live:function(b,a,d){h(document.documentElement,b,a,d)},delegate:function(b,a,d){$_.each(function(c){h(c,b,a,d)})},trigger:function(b){return this.el.dispatchEvent(b)}})})();
|
||||
(function(e){function c(a,d,b){var c;a.hasAttribute(d)&&(c=a.getAttribute(d));if(c===e&&(b===e||null===b))return null;if(b===e)return c;b!==e&&null!==b?a.setAttribute(d,b):null===b&&a.removeAttribute(d);return b!==e?b:c}function h(a){return String(a).replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function b(a,d,b){var c;d=h(d);c={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if(b===e&&a.style[d]!==e)return a.style[d];if(b===e&&a.style[c[d]]!==e)return a.style[c[d]];
|
||||
if(a.style[d]!==e)return a.style[d]=b,null;if(a.style[c[d]])return a.style[c[d]]=b,null}$_.ext("dom",{addClass:function(a){$_.each(function(b){b.classList.add(a)})},removeClass:function(a){$_.each(function(b){b.classList.remove(a)})},hide:function(){this.css("display","none")},show:function(a){a===e&&(a="block");this.css("display",a)},attr:function(a,b){var g=this.el;if(1<g.length&&b===e)return null;if(1<g.length&&b!==e)$_.each(function(e){return c(e,a,b)});else return c(g,a,b)},text:function(a){var b,
|
||||
c,f;f=this.el;c=a!==e?!0:!1;b=f.textContent;return c?f.textContent=a:b},css:function(a,d){var c=null;if("object"===$_.type(a))for(c in a)a.hasOwnProperty(c)&&$_.each(function(d){b(d,c,a[c])});else if(d===e&&"object"!==$_.type(a))return b(this.el,a);$_.each(function(c){b(c,a,d)})},append:function(a){this.el.insertAdjacentHTML("beforeend",a)},prepend:function(a){this.el.insertAdjacentHTML("afterbegin",a)},html:function(a){a!==e&&(this.el.innerHTML=a);return this.el.innerHTML}})})();
|
||||
(function(e){var d,h,b;d=function(a,c){b=a===e?d.el!==e?d.el:document.documentElement:h(a,c);d.prototype.el=b;var g=Object.create(d),f;for(f in g)"object"===typeof g[f]&&(g[f].el=b);g.el=b;return g};h=function(a,c){var b;if("string"!=typeof a||a===e)return a;c=null!=c&&1===c.nodeType?c:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);b=c.querySelectorAll(a);return 1===b.length?b[0]:b};d.ext=function(a,c){c.el=b;d[a]=c};d.ext("each",function(a){b.length!==e&&b!==
|
||||
window?[].forEach.call(b,a):a.call(b,b)});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.$=h})();
|
||||
(function(e){var d={_do:function(d,b,a,c,g){var f=new XMLHttpRequest;a===e&&(a=function(){});g=g?"POST":"GET";"GET"===g&&(d+=d.match(/\?/)?this._serialize(b):"?"+this._serialize(b));f.open(g,d);f.onreadystatechange=function(){4===f.readyState&&(200===f.status?a.call(f.responseText,f.responseText):c!==e&&c.call(f.status,f.status))};"POST"===g?(f.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),f.send(this._serialize(b))):f.send(null)},_serialize:function(d){var b,a,c=[];for(b in d)d.hasOwnProperty(b)&&
|
||||
"function"!==$_.type(d[b])&&(a=d[b].toString(),b=encodeURIComponent(b),a=encodeURIComponent(a),c.push(b+"="+a));return c.join("&")}};$_.ext("get",function(e,b,a,c){d._do(e,b,a,c,!1)});$_.ext("post",function(e,b,a,c){d._do(e,b,a,c,!0)})})();
|
||||
(function(e){var d,h;d=function(b,a,c,g){var f,e;if(a.match(/^([\w\-]+)$/))!0===g?b.addEventListener(a,c,!1):b.removeEventListener(a,c,!1);else for(a=a.split(" "),e=a.length,f=0;f<e;f++)d(b,a[f],c,g)};h=function(b,a,c,g){d(b,c,function(c){var d,e;e=$_.$(a,b);for(d in e)c.target==e[d]&&(g.call(e[d],c),c.stopPropagation())},!0)};$_.ext("event",{create:function(b,a){a=a||{};var c=document.createEvent("CustomEvent");c.initCustomEvent(b,!0,!0,a);return c},add:function(b,a){$_.each(function(c){d(c,b,a,
|
||||
!0)})},remove:function(b,a){$_.each(function(c){d(c,b,a,!1)})},live:function(b,a,c){h(document.documentElement,b,a,c)},delegate:function(b,a,c){$_.each(function(g){h(g,b,a,c)})},trigger:function(b){return this.el.dispatchEvent(b)}})})();
|
||||
(function(e){function d(a,c,b){var d;a.hasAttribute(c)&&(d=a.getAttribute(c));if(d===e&&(b===e||null===b))return null;if(b===e)return d;b!==e&&null!==b?a.setAttribute(c,b):null===b&&a.removeAttribute(c);return b!==e?b:d}function h(a){return String(a).replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function b(a,c,b){c=h(c);if(b===e&&a.style[c]!==e)return a.style[c];if(a.style[c]!==e)return a.style[c]=b,null}$_.ext("dom",{addClass:function(a){$_.each(function(c){c.classList.add(a)})},
|
||||
removeClass:function(a){$_.each(function(c){c.classList.remove(a)})},hide:function(){this.css("display","none")},show:function(a){a===e&&(a="block");this.css("display",a)},attr:function(a,c){var b=this.el;if(1<b.length&&c===e)return null;if(1<b.length&&c!==e)$_.each(function(b){return d(b,a,c)});else return d(b,a,c)},text:function(a){var b,d,f;f=this.el;d=a!==e?!0:!1;b=f.textContent;return d?f.textContent=a:b},css:function(a,c){if("object"===$_.type(a))Object.keys(a).forEach(function(c){$_.each(function(d){b(d,
|
||||
c,a[c])})});else if(c===e&&"object"!==$_.type(a))return b(this.el,a);$_.each(function(d){b(d,a,c)})},append:function(a){this.el.insertAdjacentHTML("beforeend",a)},prepend:function(a){this.el.insertAdjacentHTML("afterbegin",a)},html:function(a){a!==e&&(this.el.innerHTML=a);return this.el.innerHTML}})})();
|
||||
|
@ -19,9 +19,10 @@
|
||||
* @constructor
|
||||
* @namespace $_
|
||||
* @param {string} selector - The dom selector string
|
||||
* @param {Object} [context] - Context of the dom selector string
|
||||
* @return {Object}
|
||||
*/
|
||||
$_ = function(s)
|
||||
$_ = function(s, context)
|
||||
{
|
||||
// Have documentElement be default selector, just in case
|
||||
if (s === undefined)
|
||||
@ -33,7 +34,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
sel = $(s);
|
||||
sel = $(s, context);
|
||||
}
|
||||
|
||||
// Add the selector to the prototype
|
||||
@ -64,29 +65,29 @@
|
||||
* @param {Object} [context]
|
||||
* @return {Object}
|
||||
*/
|
||||
$ = function (a, context)
|
||||
$ = function (selector, context)
|
||||
{
|
||||
var x, c;
|
||||
var elements;
|
||||
|
||||
if (typeof a != "string" || a === undefined){ return a;}
|
||||
if (typeof selector != "string" || selector === undefined){ return selector;}
|
||||
|
||||
//Check for a context of a specific element, otherwise, just run on the document
|
||||
c = (context != null && context.nodeType === 1)
|
||||
context = (context != null && context.nodeType === 1)
|
||||
? context
|
||||
: document;
|
||||
|
||||
//Pick the quickest method for each kind of selector
|
||||
if (a.match(/^#([\w\-]+$)/))
|
||||
if (selector.match(/^#([\w\-]+$)/))
|
||||
{
|
||||
return document.getElementById(a.split('#')[1]);
|
||||
return document.getElementById(selector.split('#')[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = c.querySelectorAll(a);
|
||||
elements = context.querySelectorAll(selector);
|
||||
}
|
||||
|
||||
//Return the single object if applicable
|
||||
return (x.length === 1) ? x[0] : x;
|
||||
return (elements.length === 1) ? elements[0] : elements;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -151,11 +152,6 @@
|
||||
* @file polyfill.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Promise.prototype.done polyfill
|
||||
*/
|
||||
if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this.then(cb, eb).then(null, function (err) { setTimeout(function () { throw err; }, 0); }); }; }
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@ -374,21 +370,13 @@ if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this
|
||||
*/
|
||||
create: function(name, data)
|
||||
{
|
||||
// Do a terrible browser-sniffic hack because I don't know of a good
|
||||
// feature test
|
||||
if (/MSIE|Trident/i.test(navigator.userAgent))
|
||||
{
|
||||
data = data || {};
|
||||
|
||||
// Okay, I guess we have to do this the hard way... :(
|
||||
// Microsoft, your browser still sucks
|
||||
var e = document.createEvent('CustomEvent');
|
||||
e.initCustomEvent(name, true, true, data);
|
||||
|
||||
return e;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new CustomEvent(name, data);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Adds an event that returns a callback when triggered on the selected
|
||||
@ -538,40 +526,20 @@ if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this
|
||||
|
||||
function _css(sel, prop, val)
|
||||
{
|
||||
var equi;
|
||||
|
||||
//Camel-case
|
||||
prop = _toCamel(prop);
|
||||
|
||||
//Equivalent properties for 'special' browsers
|
||||
equi = {
|
||||
outerHeight: "offsetHeight",
|
||||
outerWidth: "offsetWidth",
|
||||
top: "posTop"
|
||||
};
|
||||
|
||||
|
||||
//If you don't define a value, try returning the existing value
|
||||
if(val === undefined && sel.style[prop] !== undefined)
|
||||
{
|
||||
return sel.style[prop];
|
||||
}
|
||||
else if(val === undefined && sel.style[equi[prop]] !== undefined)
|
||||
{
|
||||
return sel.style[equi[prop]];
|
||||
}
|
||||
|
||||
//Let's try the easy way first
|
||||
// Let's set a value instead
|
||||
if(sel.style[prop] !== undefined)
|
||||
{
|
||||
sel.style[prop] = val;
|
||||
|
||||
//Short circuit
|
||||
return null;
|
||||
}
|
||||
else if(sel.style[equi[prop]])
|
||||
{
|
||||
sel.style[equi[prop]] = val;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -737,14 +705,11 @@ if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this
|
||||
// If passed an object, recurse!
|
||||
if($_.type(prop) === 'object')
|
||||
{
|
||||
for (prop_key in prop)
|
||||
{
|
||||
if ( ! prop.hasOwnProperty(prop_key)) continue;
|
||||
|
||||
Object.keys(prop).forEach(function(prop_key) {
|
||||
$_.each(function (e){
|
||||
_css(e, prop_key, prop[prop_key]);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//Return the current value if a value is not set
|
||||
else if(val === undefined && $_.type(prop) !== 'object')
|
||||
|
12
kis-lite-min.js
vendored
12
kis-lite-min.js
vendored
@ -1,6 +1,6 @@
|
||||
(function(e){var b,f,c;b=function(a){c=a===e?b.el!==e?b.el:document.documentElement:f(a);b.prototype.el=c;a=Object.create(b);for(var d in a)"object"===typeof a[d]&&(a[d].el=c);a.el=c;return a};f=function(a,c){var b;if("string"!=typeof a||a===e)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};b.ext=function(a,d){d.el=c;b[a]=d};b.ext("each",function(a){c.length!==e&&c!==window?
|
||||
[].forEach.call(c,a):a.call(c,c)});b.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()};b=window.$_=window.$_||b;b.$=f})();Promise.prototype.done||(Promise.prototype.done=function(e,b){this.then(e,b).then(null,function(b){setTimeout(function(){throw b;},0)})});
|
||||
(function(e){var b={_do:function(b,c,a,d,h){var g=new XMLHttpRequest;a===e&&(a=function(){});h=h?"POST":"GET";"GET"===h&&(b+=b.match(/\?/)?this._serialize(c):"?"+this._serialize(c));g.open(h,b);g.onreadystatechange=function(){4===g.readyState&&(200===g.status?a.call(g.responseText,g.responseText):d!==e&&d.call(g.status,g.status))};"POST"===h?(g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(this._serialize(c))):g.send(null)},_serialize:function(b){var c,a,d=[];for(c in b)b.hasOwnProperty(c)&&
|
||||
"function"!==$_.type(b[c])&&(a=b[c].toString(),c=encodeURIComponent(c),a=encodeURIComponent(a),d.push(c+"="+a));return d.join("&")}};$_.ext("get",function(f,c,a,d){b._do(f,c,a,d,!1)});$_.ext("post",function(f,c,a,d){b._do(f,c,a,d,!0)})})();
|
||||
(function(e){var b,f;b=function(c,a,d,h){var g,f;if(a.match(/^([\w\-]+)$/))!0===h?c.addEventListener(a,d,!1):c.removeEventListener(a,d,!1);else for(a=a.split(" "),f=a.length,g=0;g<f;g++)b(c,a[g],d,h)};f=function(c,a,d,f){b(c,d,function(b){var d,e;e=$_.$(a,c);for(d in e)b.target==e[d]&&(f.call(e[d],b),b.stopPropagation())},!0)};$_.ext("event",{create:function(c,a){if(/MSIE|Trident/i.test(navigator.userAgent)){var b=document.createEvent("CustomEvent");b.initCustomEvent(c,!0,!0,a);return b}return new CustomEvent(c,
|
||||
a)},add:function(c,a){$_.each(function(d){b(d,c,a,!0)})},remove:function(c,a){$_.each(function(d){b(d,c,a,!1)})},live:function(c,a,b){f(document.documentElement,c,a,b)},delegate:function(b,a,d){$_.each(function(e){f(e,b,a,d)})},trigger:function(b){return this.el.dispatchEvent(b)}})})();
|
||||
(function(h){var c,g,b;c=function(a,d){b=a===h?c.el!==h?c.el:document.documentElement:g(a,d);c.prototype.el=b;var e=Object.create(c),f;for(f in e)"object"===typeof e[f]&&(e[f].el=b);e.el=b;return e};g=function(a,b){var e;if("string"!=typeof a||a===h)return a;b=null!=b&&1===b.nodeType?b:document;if(a.match(/^#([\w\-]+$)/))return document.getElementById(a.split("#")[1]);e=b.querySelectorAll(a);return 1===e.length?e[0]:e};c.ext=function(a,d){d.el=b;c[a]=d};c.ext("each",function(a){b.length!==h&&b!==
|
||||
window?[].forEach.call(b,a):a.call(b,b)});c.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()};c=window.$_=window.$_||c;c.$=g})();
|
||||
(function(h){var c={_do:function(c,b,a,d,e){var f=new XMLHttpRequest;a===h&&(a=function(){});e=e?"POST":"GET";"GET"===e&&(c+=c.match(/\?/)?this._serialize(b):"?"+this._serialize(b));f.open(e,c);f.onreadystatechange=function(){4===f.readyState&&(200===f.status?a.call(f.responseText,f.responseText):d!==h&&d.call(f.status,f.status))};"POST"===e?(f.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),f.send(this._serialize(b))):f.send(null)},_serialize:function(c){var b,a,d=[];for(b in c)c.hasOwnProperty(b)&&
|
||||
"function"!==$_.type(c[b])&&(a=c[b].toString(),b=encodeURIComponent(b),a=encodeURIComponent(a),d.push(b+"="+a));return d.join("&")}};$_.ext("get",function(g,b,a,d){c._do(g,b,a,d,!1)});$_.ext("post",function(g,b,a,d){c._do(g,b,a,d,!0)})})();
|
||||
(function(h){var c,g;c=function(b,a,d,e){var f,g;if(a.match(/^([\w\-]+)$/))!0===e?b.addEventListener(a,d,!1):b.removeEventListener(a,d,!1);else for(a=a.split(" "),g=a.length,f=0;f<g;f++)c(b,a[f],d,e)};g=function(b,a,d,e){c(b,d,function(c){var d,g;g=$_.$(a,b);for(d in g)c.target==g[d]&&(e.call(g[d],c),c.stopPropagation())},!0)};$_.ext("event",{create:function(b,a){a=a||{};var c=document.createEvent("CustomEvent");c.initCustomEvent(b,!0,!0,a);return c},add:function(b,a){$_.each(function(d){c(d,b,a,
|
||||
!0)})},remove:function(b,a){$_.each(function(d){c(d,b,a,!1)})},live:function(b,a,c){g(document.documentElement,b,a,c)},delegate:function(b,a,c){$_.each(function(e){g(e,b,a,c)})},trigger:function(b){return this.el.dispatchEvent(b)}})})();
|
||||
|
38
kis-lite.js
38
kis-lite.js
@ -19,9 +19,10 @@
|
||||
* @constructor
|
||||
* @namespace $_
|
||||
* @param {string} selector - The dom selector string
|
||||
* @param {Object} [context] - Context of the dom selector string
|
||||
* @return {Object}
|
||||
*/
|
||||
$_ = function(s)
|
||||
$_ = function(s, context)
|
||||
{
|
||||
// Have documentElement be default selector, just in case
|
||||
if (s === undefined)
|
||||
@ -33,7 +34,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
sel = $(s);
|
||||
sel = $(s, context);
|
||||
}
|
||||
|
||||
// Add the selector to the prototype
|
||||
@ -64,29 +65,29 @@
|
||||
* @param {Object} [context]
|
||||
* @return {Object}
|
||||
*/
|
||||
$ = function (a, context)
|
||||
$ = function (selector, context)
|
||||
{
|
||||
var x, c;
|
||||
var elements;
|
||||
|
||||
if (typeof a != "string" || a === undefined){ return a;}
|
||||
if (typeof selector != "string" || selector === undefined){ return selector;}
|
||||
|
||||
//Check for a context of a specific element, otherwise, just run on the document
|
||||
c = (context != null && context.nodeType === 1)
|
||||
context = (context != null && context.nodeType === 1)
|
||||
? context
|
||||
: document;
|
||||
|
||||
//Pick the quickest method for each kind of selector
|
||||
if (a.match(/^#([\w\-]+$)/))
|
||||
if (selector.match(/^#([\w\-]+$)/))
|
||||
{
|
||||
return document.getElementById(a.split('#')[1]);
|
||||
return document.getElementById(selector.split('#')[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = c.querySelectorAll(a);
|
||||
elements = context.querySelectorAll(selector);
|
||||
}
|
||||
|
||||
//Return the single object if applicable
|
||||
return (x.length === 1) ? x[0] : x;
|
||||
return (elements.length === 1) ? elements[0] : elements;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -151,11 +152,6 @@
|
||||
* @file polyfill.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Promise.prototype.done polyfill
|
||||
*/
|
||||
if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this.then(cb, eb).then(null, function (err) { setTimeout(function () { throw err; }, 0); }); }; }
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@ -374,21 +370,13 @@ if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this
|
||||
*/
|
||||
create: function(name, data)
|
||||
{
|
||||
// Do a terrible browser-sniffic hack because I don't know of a good
|
||||
// feature test
|
||||
if (/MSIE|Trident/i.test(navigator.userAgent))
|
||||
{
|
||||
data = data || {};
|
||||
|
||||
// Okay, I guess we have to do this the hard way... :(
|
||||
// Microsoft, your browser still sucks
|
||||
var e = document.createEvent('CustomEvent');
|
||||
e.initCustomEvent(name, true, true, data);
|
||||
|
||||
return e;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new CustomEvent(name, data);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Adds an event that returns a callback when triggered on the selected
|
||||
|
18
kis-min.js
vendored
18
kis-min.js
vendored
@ -1,9 +1,9 @@
|
||||
(function(e){var d,m,f;d=function(k){f=k===e?d.el!==e?d.el:document.documentElement:m(k);d.prototype.el=f;k=Object.create(d);for(var n in k)"object"===typeof k[n]&&(k[n].el=f);k.el=f;return k};m=function(d,f){var l;if("string"!=typeof d||d===e)return d;l=null!=f&&1===f.nodeType?f:document;if(d.match(/^#([\w\-]+$)/))return document.getElementById(d.split("#")[1]);l=l.querySelectorAll(d);return 1===l.length?l[0]:l};d.ext=function(e,m){m.el=f;d[e]=m};d.ext("each",function(d){f.length!==e&&f!==window?
|
||||
[].forEach.call(f,d):d.call(f,f)});d.type=function(d){return function(){return d&&d!==this}.call(d)?(typeof d).toLowerCase():{}.toString.call(d).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};d=window.$_=window.$_||d;d.$=m})();Promise.prototype.done||(Promise.prototype.done=function(e,d){this.then(e,d).then(null,function(d){setTimeout(function(){throw d;},0)})});
|
||||
(function(e,d){function m(a,b,c){var h;a.hasAttribute(b)&&(h=a.getAttribute(b));if(h===d&&(c===d||null===c))return null;if(c===d)return h;c!==d&&null!==c?a.setAttribute(b,c):null===c&&a.removeAttribute(b);return c!==d?c:h}function f(a){return String(a).replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function k(a,b,c){var h;b=f(b);h={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if(c===d&&a.style[b]!==d)return a.style[b];if(c===d&&a.style[h[b]]!==d)return a.style[h[b]];
|
||||
if(a.style[b]!==d)return a.style[b]=c,null;if(a.style[h[b]])return a.style[h[b]]=c,null}e.ext("dom",{addClass:function(a){e.each(function(b){b.classList.add(a)})},removeClass:function(a){e.each(function(b){b.classList.remove(a)})},hide:function(){this.css("display","none")},show:function(a){a===d&&(a="block");this.css("display",a)},attr:function(a,b){var c=this.el;if(1<c.length&&b===d)return null;if(1<c.length&&b!==d)e.each(function(c){return m(c,a,b)});else return m(c,a,b)},text:function(a){var b,
|
||||
c,h;h=this.el;c=a!==d?!0:!1;b=h.textContent;return c?h.textContent=a:b},css:function(a,b){var c=null;if("object"===e.type(a))for(c in a)a.hasOwnProperty(c)&&e.each(function(b){k(b,c,a[c])});else if(b===d&&"object"!==e.type(a))return k(this.el,a);e.each(function(c){k(c,a,b)})},append:function(a){this.el.insertAdjacentHTML("beforeend",a)},prepend:function(a){this.el.insertAdjacentHTML("afterbegin",a)},html:function(a){a!==d&&(this.el.innerHTML=a);return this.el.innerHTML}});var n={_do:function(a,b,
|
||||
c,h,e){var g=new XMLHttpRequest;c===d&&(c=function(){});e=e?"POST":"GET";"GET"===e&&(a+=a.match(/\?/)?this._serialize(b):"?"+this._serialize(b));g.open(e,a);g.onreadystatechange=function(){4===g.readyState&&(200===g.status?c.call(g.responseText,g.responseText):h!==d&&h.call(g.status,g.status))};"POST"===e?(g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(this._serialize(b))):g.send(null)},_serialize:function(a){var b,c,d=[];for(b in a)a.hasOwnProperty(b)&&"function"!==
|
||||
e.type(a[b])&&(c=a[b].toString(),b=encodeURIComponent(b),c=encodeURIComponent(c),d.push(b+"="+c));return d.join("&")}};e.ext("get",function(a,b,c,d){n._do(a,b,c,d,!1)});e.ext("post",function(a,b,c,d){n._do(a,b,c,d,!0)});var l,r;l=function(a,b,c,d){var e,g;if(b.match(/^([\w\-]+)$/))!0===d?a.addEventListener(b,c,!1):a.removeEventListener(b,c,!1);else for(b=b.split(" "),g=b.length,e=0;e<g;e++)l(a,b[e],c,d)};r=function(a,b,c,d){l(a,c,function(c){var g,f;f=e.$(b,a);for(g in f)c.target==f[g]&&(d.call(f[g],
|
||||
c),c.stopPropagation())},!0)};e.ext("event",{create:function(a,b){if(/MSIE|Trident/i.test(navigator.userAgent)){var c=document.createEvent("CustomEvent");c.initCustomEvent(a,!0,!0,b);return c}return new CustomEvent(a,b)},add:function(a,b){e.each(function(c){l(c,a,b,!0)})},remove:function(a,b){e.each(function(c){l(c,a,b,!1)})},live:function(a,b,c){r(document.documentElement,a,b,c)},delegate:function(a,b,c){e.each(function(d){r(d,a,b,c)})},trigger:function(a){return this.el.dispatchEvent(a)}});var p=
|
||||
localStorage,q=sessionStorage;e.ext("store",{get:function(a,b){var c=b?q.getItem(a):p.getItem(a);return JSON.parse(c)},set:function(a,b,c){b=JSON.stringify(b);c?q.setItem(a,b):p.setItem(a,b)},remove:function(a,b){b?q.removeItem(a):p.removeItem(a)},getAll:function(a){var b,c={},d,e;e=a?p:q;b=e.length;for(a=0;a<b;a++)d=e.key(a),c[d]=e.getItem(d);return c},clear:function(a){a?q.clear():p.clear()}})})($_);
|
||||
(function(e){var c,n,k;c=function(p,h){k=p===e?c.el!==e?c.el:document.documentElement:n(p,h);c.prototype.el=k;var f=Object.create(c),m;for(m in f)"object"===typeof f[m]&&(f[m].el=k);f.el=k;return f};n=function(c,h){var f;if("string"!=typeof c||c===e)return c;h=null!=h&&1===h.nodeType?h:document;if(c.match(/^#([\w\-]+$)/))return document.getElementById(c.split("#")[1]);f=h.querySelectorAll(c);return 1===f.length?f[0]:f};c.ext=function(e,h){h.el=k;c[e]=h};c.ext("each",function(c){k.length!==e&&k!==
|
||||
window?[].forEach.call(k,c):c.call(k,k)});c.type=function(c){return function(){return c&&c!==this}.call(c)?(typeof c).toLowerCase():{}.toString.call(c).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()};c=window.$_=window.$_||c;c.$=n})();
|
||||
(function(e,c){function n(a,b,d){var l;a.hasAttribute(b)&&(l=a.getAttribute(b));if(l===c&&(d===c||null===d))return null;if(d===c)return l;d!==c&&null!==d?a.setAttribute(b,d):null===d&&a.removeAttribute(b);return d!==c?d:l}function k(a){return String(a).replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function p(a,b,d){b=k(b);if(d===c&&a.style[b]!==c)return a.style[b];if(a.style[b]!==c)return a.style[b]=d,null}e.ext("dom",{addClass:function(a){e.each(function(b){b.classList.add(a)})},
|
||||
removeClass:function(a){e.each(function(b){b.classList.remove(a)})},hide:function(){this.css("display","none")},show:function(a){a===c&&(a="block");this.css("display",a)},attr:function(a,b){var d=this.el;if(1<d.length&&b===c)return null;if(1<d.length&&b!==c)e.each(function(d){return n(d,a,b)});else return n(d,a,b)},text:function(a){var b,d,l;l=this.el;d=a!==c?!0:!1;b=l.textContent;return d?l.textContent=a:b},css:function(a,b){if("object"===e.type(a))Object.keys(a).forEach(function(b){e.each(function(c){p(c,
|
||||
b,a[b])})});else if(b===c&&"object"!==e.type(a))return p(this.el,a);e.each(function(d){p(d,a,b)})},append:function(a){this.el.insertAdjacentHTML("beforeend",a)},prepend:function(a){this.el.insertAdjacentHTML("afterbegin",a)},html:function(a){a!==c&&(this.el.innerHTML=a);return this.el.innerHTML}});var h={_do:function(a,b,d,l,e){var g=new XMLHttpRequest;d===c&&(d=function(){});e=e?"POST":"GET";"GET"===e&&(a+=a.match(/\?/)?this._serialize(b):"?"+this._serialize(b));g.open(e,a);g.onreadystatechange=
|
||||
function(){4===g.readyState&&(200===g.status?d.call(g.responseText,g.responseText):l!==c&&l.call(g.status,g.status))};"POST"===e?(g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.send(this._serialize(b))):g.send(null)},_serialize:function(a){var b,d,c=[];for(b in a)a.hasOwnProperty(b)&&"function"!==e.type(a[b])&&(d=a[b].toString(),b=encodeURIComponent(b),d=encodeURIComponent(d),c.push(b+"="+d));return c.join("&")}};e.ext("get",function(a,b,d,c){h._do(a,b,d,c,!1)});e.ext("post",
|
||||
function(a,b,d,c){h._do(a,b,d,c,!0)});var f,m;f=function(a,b,d,c){var e,g;if(b.match(/^([\w\-]+)$/))!0===c?a.addEventListener(b,d,!1):a.removeEventListener(b,d,!1);else for(b=b.split(" "),g=b.length,e=0;e<g;e++)f(a,b[e],d,c)};m=function(a,b,d,c){f(a,d,function(d){var g,f;f=e.$(b,a);for(g in f)d.target==f[g]&&(c.call(f[g],d),d.stopPropagation())},!0)};e.ext("event",{create:function(a,b){b=b||{};var d=document.createEvent("CustomEvent");d.initCustomEvent(a,!0,!0,b);return d},add:function(a,b){e.each(function(d){f(d,
|
||||
a,b,!0)})},remove:function(a,b){e.each(function(d){f(d,a,b,!1)})},live:function(a,b,d){m(document.documentElement,a,b,d)},delegate:function(a,b,d){e.each(function(c){m(c,a,b,d)})},trigger:function(a){return this.el.dispatchEvent(a)}});var q=localStorage,r=sessionStorage;e.ext("store",{get:function(a,b){var d=b?r.getItem(a):q.getItem(a);return JSON.parse(d)},set:function(a,b,d){b=JSON.stringify(b);d?r.setItem(a,b):q.setItem(a,b)},remove:function(a,b){b?r.removeItem(a):q.removeItem(a)},getAll:function(a){var b,
|
||||
d={},c,e;e=a?q:r;b=e.length;for(a=0;a<b;a++)c=e.key(a),d[c]=e.getItem(c);return d},clear:function(a){a?r.clear():q.clear()}})})($_);
|
||||
|
21
src/core.js
21
src/core.js
@ -19,9 +19,10 @@
|
||||
* @constructor
|
||||
* @namespace $_
|
||||
* @param {string} selector - The dom selector string
|
||||
* @param {Object} [context] - Context of the dom selector string
|
||||
* @return {Object}
|
||||
*/
|
||||
$_ = function(s)
|
||||
$_ = function(s, context)
|
||||
{
|
||||
// Have documentElement be default selector, just in case
|
||||
if (s === undefined)
|
||||
@ -33,7 +34,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
sel = $(s);
|
||||
sel = $(s, context);
|
||||
}
|
||||
|
||||
// Add the selector to the prototype
|
||||
@ -64,29 +65,29 @@
|
||||
* @param {Object} [context]
|
||||
* @return {Object}
|
||||
*/
|
||||
$ = function (a, context)
|
||||
$ = function (selector, context)
|
||||
{
|
||||
var x, c;
|
||||
var elements;
|
||||
|
||||
if (typeof a != "string" || a === undefined){ return a;}
|
||||
if (typeof selector != "string" || selector === undefined){ return selector;}
|
||||
|
||||
//Check for a context of a specific element, otherwise, just run on the document
|
||||
c = (context != null && context.nodeType === 1)
|
||||
context = (context != null && context.nodeType === 1)
|
||||
? context
|
||||
: document;
|
||||
|
||||
//Pick the quickest method for each kind of selector
|
||||
if (a.match(/^#([\w\-]+$)/))
|
||||
if (selector.match(/^#([\w\-]+$)/))
|
||||
{
|
||||
return document.getElementById(a.split('#')[1]);
|
||||
return document.getElementById(selector.split('#')[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = c.querySelectorAll(a);
|
||||
elements = context.querySelectorAll(selector);
|
||||
}
|
||||
|
||||
//Return the single object if applicable
|
||||
return (x.length === 1) ? x[0] : x;
|
||||
return (elements.length === 1) ? elements[0] : elements;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -58,40 +58,20 @@
|
||||
|
||||
function _css(sel, prop, val)
|
||||
{
|
||||
var equi;
|
||||
|
||||
//Camel-case
|
||||
prop = _toCamel(prop);
|
||||
|
||||
//Equivalent properties for 'special' browsers
|
||||
equi = {
|
||||
outerHeight: "offsetHeight",
|
||||
outerWidth: "offsetWidth",
|
||||
top: "posTop"
|
||||
};
|
||||
|
||||
|
||||
//If you don't define a value, try returning the existing value
|
||||
if(val === undefined && sel.style[prop] !== undefined)
|
||||
{
|
||||
return sel.style[prop];
|
||||
}
|
||||
else if(val === undefined && sel.style[equi[prop]] !== undefined)
|
||||
{
|
||||
return sel.style[equi[prop]];
|
||||
}
|
||||
|
||||
//Let's try the easy way first
|
||||
// Let's set a value instead
|
||||
if(sel.style[prop] !== undefined)
|
||||
{
|
||||
sel.style[prop] = val;
|
||||
|
||||
//Short circuit
|
||||
return null;
|
||||
}
|
||||
else if(sel.style[equi[prop]])
|
||||
{
|
||||
sel.style[equi[prop]] = val;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -257,14 +237,11 @@
|
||||
// If passed an object, recurse!
|
||||
if($_.type(prop) === 'object')
|
||||
{
|
||||
for (prop_key in prop)
|
||||
{
|
||||
if ( ! prop.hasOwnProperty(prop_key)) continue;
|
||||
|
||||
Object.keys(prop).forEach(function(prop_key) {
|
||||
$_.each(function (e){
|
||||
_css(e, prop_key, prop[prop_key]);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//Return the current value if a value is not set
|
||||
else if(val === undefined && $_.type(prop) !== 'object')
|
||||
|
@ -85,21 +85,13 @@
|
||||
*/
|
||||
create: function(name, data)
|
||||
{
|
||||
// Do a terrible browser-sniffic hack because I don't know of a good
|
||||
// feature test
|
||||
if (/MSIE|Trident/i.test(navigator.userAgent))
|
||||
{
|
||||
data = data || {};
|
||||
|
||||
// Okay, I guess we have to do this the hard way... :(
|
||||
// Microsoft, your browser still sucks
|
||||
var e = document.createEvent('CustomEvent');
|
||||
e.initCustomEvent(name, true, true, data);
|
||||
|
||||
return e;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new CustomEvent(name, data);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Adds an event that returns a callback when triggered on the selected
|
||||
|
@ -2,8 +2,3 @@
|
||||
* A module of various browser polyfills
|
||||
* @file polyfill.js
|
||||
*/
|
||||
|
||||
/**
|
||||
* Promise.prototype.done polyfill
|
||||
*/
|
||||
if (!Promise.prototype.done) { Promise.prototype.done = function (cb, eb) { this.then(cb, eb).then(null, function (err) { setTimeout(function () { throw err; }, 0); }); }; }
|
@ -53,7 +53,7 @@
|
||||
});
|
||||
|
||||
test("Attr", function(){
|
||||
expect(3);
|
||||
expect(4);
|
||||
|
||||
var $test = $_("section");
|
||||
var ele = $test.el;
|
||||
@ -65,10 +65,13 @@
|
||||
|
||||
equal($_("div").dom.attr('id'), null, "Trying to get an attribute for multiple elements");
|
||||
|
||||
$test.dom.attr('id', null);
|
||||
equal($test.dom.attr('id'), null, "Non-existent attribute");
|
||||
|
||||
});
|
||||
|
||||
test("CSS", function(){
|
||||
expect(2);
|
||||
expect(4);
|
||||
|
||||
var $test = $_("section[hidden='hidden']");
|
||||
var ele = $test.el;
|
||||
@ -76,6 +79,14 @@
|
||||
$test.dom.css("display", "block");
|
||||
equal(ele.style.display, "block", "Setting CSS");
|
||||
equal($test.dom.css("display"), "block", "Getting CSS");
|
||||
|
||||
// Multiple styles
|
||||
$test.dom.css({
|
||||
'border-color':'rgb(0, 0, 0)',
|
||||
'border-radius':'5px'
|
||||
});
|
||||
equal(ele.style.borderColor, 'rgb(0, 0, 0)', 'Setting multiple css values 1');
|
||||
equal(ele.style.borderRadius, '5px', 'Setting multiple css values 2');
|
||||
});
|
||||
|
||||
test("html", function(){
|
||||
|
Loading…
Reference in New Issue
Block a user