Simplify and cleanup event and dom modules, add context option to main constructor

This commit is contained in:
Timothy Warren 2014-09-12 16:14:12 -04:00
parent 8e9d93a525
commit 3ef9e89ab6
24 changed files with 202 additions and 334 deletions

View File

@ -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>
@ -92,6 +92,8 @@ Dom manipulation module</div>
@ -102,7 +104,7 @@ Dom manipulation module</div>
<dl>
<dt>
<h4 class="name" id="addClass"><span class="type-signature">&lt;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">&lt;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">&lt;static> </span>attr<span class="signature">(name, <span class="optional">value</span>)</span><span class="type-signature"> &rarr; {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"> &rarr; (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">&lt;static> </span>css<span class="signature">(property, <span class="optional">value</span>)</span><span class="type-signature"> &rarr; {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"> &rarr; (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">&lt;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">&lt;static> </span>html<span class="signature">(<span class="optional">htm</span>)</span><span class="type-signature"> &rarr; {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"> &rarr; (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">&lt;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">&lt;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">&lt;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">&lt;static> </span>text<span class="signature">(<span class="optional">value</span>)</span><span class="type-signature"> &rarr; {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"> &rarr; (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>

View File

@ -90,6 +90,8 @@
@ -100,7 +102,7 @@
<dl>
<dt>
<h4 class="name" id="add"><span class="type-signature">&lt;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">&lt;static> </span>create<span class="signature">(name, <span class="optional">data</span>)</span><span class="type-signature"> &rarr; {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"> &rarr; {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">&lt;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">&lt;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">&lt;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">&lt;static> </span>trigger<span class="signature">(event)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<h4 class="name" id="trigger"><span class="type-signature">(static) </span>trigger<span class="signature">(event)</span><span class="type-signature"> &rarr; {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>

View File

@ -90,6 +90,8 @@ Constructor function</div>
<h3 class="subsection-title">Namespaces</h3>
@ -113,7 +115,7 @@ Constructor function</div>
<dl>
<dt>
<h4 class="name" id="$"><span class="type-signature">&lt;static> </span>$<span class="signature">(selector, <span class="optional">context</span>)</span><span class="type-signature"> &rarr; {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"> &rarr; {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">&lt;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">&lt;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">&lt;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>

View File

@ -92,6 +92,8 @@ to use sessionStorage rather than the default localStorage.</div>
@ -102,7 +104,7 @@ to use sessionStorage rather than the default localStorage.</div>
<dl>
<dt>
<h4 class="name" id="clear"><span class="type-signature">&lt;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">&lt;static> </span>get<span class="signature">(key, session)</span><span class="type-signature"> &rarr; {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"> &rarr; {Object}</span></h4>
</dt>
@ -382,7 +384,7 @@ based on the specified key
<dt>
<h4 class="name" id="getAll"><span class="type-signature">&lt;static> </span>getAll<span class="signature">(session)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<h4 class="name" id="getAll"><span class="type-signature">(static) </span>getAll<span class="signature">(session)</span><span class="type-signature"> &rarr; {Object}</span></h4>
</dt>
@ -519,7 +521,7 @@ based on the specified key
<dt>
<h4 class="name" id="remove"><span class="type-signature">&lt;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">&lt;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>

View File

@ -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 &amp;&amp; sel.style[prop] !== undefined)
{
return sel.style[prop];
}
else if(val === undefined &amp;&amp; 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 &amp;&amp; $_.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>

View File

@ -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>

View File

@ -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 &amp;&amp; context.nodeType === 1)
context = (context != null &amp;&amp; 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>

View File

@ -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>

View File

@ -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>

View File

@ -112,6 +112,8 @@
@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -58,8 +58,7 @@ section
display: none;
}
.optional:after {
content: "opt";
.signature-attributes {
font-size: 60%;
color: #aaa;
font-style: italic;

View File

@ -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
View File

@ -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