Thoughts and under construction prototype extensions.
NOTE: Inspiration from mootools 1.2
NOTE: Taken from Protolicious (Kangax) http://github.com/kangax/protolicious/tree/master/element.methods.js
CHANGES: Tiny change made in first line
WARNING: The output is different each browsers
NOTE: Inspiration from mootools 1.2
Clone a DOM element, can be deep or shallow and keep IDs or not
INFO: support Element.Storage from this playground
Made to toggle password fields while editing user entry
To be used with similar html code :
<fieldset id="password_fields">
<legend>Change your password</legend>
<div class="field"><label for="user_password"><span class="field_name">Password <span class="hint">(leave blank to keep actual password)</span></label><input autocomplete="off" id="user_password" name="user[password]" size="30" type="password" /></div>
<div class="field"><label for="user_password_confirmation"><span class="field_name">Password confirmation</span></label><input id="user_password_confirmation" name="user[password_confirmation]" size="30" type="password" /></div>
</fieldset>
NOTE : Check the code for better understanding, it’s 15 lines only, notice included
Make labels behaving like placeholders, inspired by me.com as of 25 July 2010.
Labels attached to an input, select or textarea using the ‘for’ attribute will be hidden when their input become field, they will be shown again once blank.
<label for="my-input-id">Input</label><input id="my-input-id" name="my-input-id" value="" />
Allow to calculate the number of milliseconds since midnight of January 1, 1970 according to universal time based on an ISO 8601 formatted date time string, as Date#toJSON() produce.
Date.fromJSON("2009-11-06T13:30:12Z");
//-> 1257514212000
new Date(Date.fromJSON("2009-11-06T13:30:12Z"));
//-> Fri Nov 06 2009 15:30:12 GMT+0200 (EET)
© 2008-2010 Sébastien Grosjean
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.