Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Killing faux placeholder support for <input type="password"> since it…

… would just be obsured by "*****..." anyway.
  • Loading branch information...
commit 0e12ea77dc381bfe5fd9b6d07c5602c796a66fe3 1 parent 988875f
Nathan Smith authored

Showing 31 changed files with 135 additions and 70 deletions. Show diff stats Hide diff stats

  1. +12 0 assets/js/dojo.formalize.js
  2. +1 1  assets/js/dojo.formalize.min.js
  3. +12 7 assets/js/extjs.formalize.js
  4. +1 1  assets/js/extjs.formalize.min.js
  5. +12 0 assets/js/jquery.formalize.js
  6. +1 1  assets/js/jquery.formalize.min.js
  7. +12 0 assets/js/mootools.formalize.js
  8. +1 1  assets/js/mootools.formalize.min.js
  9. +12 0 assets/js/prototype.formalize.js
  10. +1 1  assets/js/prototype.formalize.min.js
  11. +12 0 assets/js/yui.formalize.js
  12. +1 1  assets/js/yui.formalize.min.js
  13. +3 3 dojo_demo.html
  14. +3 3 dojo_disabled.html
  15. +3 3 dojo_errors.html
  16. +3 3 extjs_demo.html
  17. +3 3 extjs_disabled.html
  18. +3 3 extjs_errors.html
  19. +3 3 jquery_demo.html
  20. +3 3 jquery_disabled.html
  21. +3 3 jquery_errors.html
  22. +3 3 mootools_demo.html
  23. +3 3 mootools_disabled.html
  24. +3 3 mootools_errors.html
  25. +3 3 prototype_demo.html
  26. +3 3 prototype_disabled.html
  27. +3 3 prototype_errors.html
  28. +3 3 unstyled.html
  29. +3 3 yui_demo.html
  30. +3 3 yui_disabled.html
  31. +3 3 yui_errors.html
12 assets/js/dojo.formalize.js
@@ -102,6 +102,12 @@ var FORMALIZE = (function(window, document, undefined) {
102 102 FORMALIZE.misc.add_placeholder();
103 103
104 104 dojo.query('[placeholder]').forEach(function(el) {
  105 + // Placeholder obscured in older browsers,
  106 + // so there's no point adding to password.
  107 + if (el.type === 'password') {
  108 + return;
  109 + }
  110 +
105 111 dojo.connect(el, 'onfocus', function() {
106 112 var text = el.getAttribute('placeholder');
107 113
@@ -147,6 +153,12 @@ var FORMALIZE = (function(window, document, undefined) {
147 153 }
148 154
149 155 dojo.query('[placeholder]').forEach(function(el) {
  156 + // Placeholder obscured in older browsers,
  157 + // so there's no point adding to password.
  158 + if (el.type === 'password') {
  159 + return;
  160 + }
  161 +
150 162 var text = el.getAttribute('placeholder');
151 163
152 164 if (!el.value || el.value === text) {
2  assets/js/dojo.formalize.min.js
... ... @@ -1 +1 @@
1   -var FORMALIZE=function(a,b){var c="placeholder"in b.createElement("input"),d="autofocus"in b.createElement("input"),e=parseInt(dojo.isIE,10)===6,f=parseInt(dojo.isIE,10)===7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){f&&dojo.query("textarea, input.input_full").length&&dojo.query("textarea, input.input_full").forEach(function(a){var c=a.cloneNode(!1),d=b.createElement("span");d.className="input_full_wrap",d.appendChild(c),a.parentNode.replaceChild(d,a)})},ie6_skin_inputs:function(){if(e&&dojo.query("input, select, textarea").length){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;dojo.query("input").forEach(function(c){c.getAttribute("type").match(a)?(dojo.addClass(c,"ie6_button"),c.disabled&&dojo.addClass(c,"ie6_button_disabled")):c.getAttribute("type").match(b)&&(dojo.addClass(c,"ie6_input"),c.disabled&&dojo.addClass(c,"ie6_input_disabled"))}),dojo.query("textarea, select").forEach(function(a){a.disabled&&dojo.addClass(a,"ie6_input_disabled")})}},autofocus:function(){d||!dojo.query("[autofocus]").length||dojo.query("[autofocus]")[0].focus()},placeholder:function(){!c&&!!dojo.query("[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),dojo.query("[placeholder]").forEach(function(a){dojo.connect(a,"onfocus",function(){var b=a.getAttribute("placeholder");a.value===b&&(a.value="",dojo.removeClass(a,"placeholder_text"))}),dojo.connect(a,"onblur",function(){FORMALIZE.misc.add_placeholder()})}),dojo.query("form").forEach(function(a){dojo.connect(a,"onsubmit",function(){dojo.query("[placeholder]",a).forEach(function(a){var b=a.getAttribute("placeholder");a.value===b&&(a.value="",dojo.removeClass(a,"placeholder_text"))})}),dojo.connect(a,"onreset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){c||!dojo.query("[placeholder]").length||dojo.query("[placeholder]").forEach(function(a){var b=a.getAttribute("placeholder");if(!a.value||a.value===b)a.value=b,dojo.addClass(a,"placeholder_text")})}}}}(this,this.document);dojo.addOnLoad(function(){FORMALIZE.go()})
  1 +var FORMALIZE=function(a,b){var c="placeholder"in b.createElement("input"),d="autofocus"in b.createElement("input"),e=parseInt(dojo.isIE,10)===6,f=parseInt(dojo.isIE,10)===7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){f&&dojo.query("textarea, input.input_full").length&&dojo.query("textarea, input.input_full").forEach(function(a){var c=a.cloneNode(!1),d=b.createElement("span");d.className="input_full_wrap",d.appendChild(c),a.parentNode.replaceChild(d,a)})},ie6_skin_inputs:function(){if(e&&dojo.query("input, select, textarea").length){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;dojo.query("input").forEach(function(c){c.getAttribute("type").match(a)?(dojo.addClass(c,"ie6_button"),c.disabled&&dojo.addClass(c,"ie6_button_disabled")):c.getAttribute("type").match(b)&&(dojo.addClass(c,"ie6_input"),c.disabled&&dojo.addClass(c,"ie6_input_disabled"))}),dojo.query("textarea, select").forEach(function(a){a.disabled&&dojo.addClass(a,"ie6_input_disabled")})}},autofocus:function(){d||!dojo.query("[autofocus]").length||dojo.query("[autofocus]")[0].focus()},placeholder:function(){!c&&!!dojo.query("[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),dojo.query("[placeholder]").forEach(function(a){a.type!=="password"&&(dojo.connect(a,"onfocus",function(){var b=a.getAttribute("placeholder");a.value===b&&(a.value="",dojo.removeClass(a,"placeholder_text"))}),dojo.connect(a,"onblur",function(){FORMALIZE.misc.add_placeholder()}))}),dojo.query("form").forEach(function(a){dojo.connect(a,"onsubmit",function(){dojo.query("[placeholder]",a).forEach(function(a){var b=a.getAttribute("placeholder");a.value===b&&(a.value="",dojo.removeClass(a,"placeholder_text"))})}),dojo.connect(a,"onreset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){c||!dojo.query("[placeholder]").length||dojo.query("[placeholder]").forEach(function(a){if(a.type!=="password"){var b=a.getAttribute("placeholder");if(!a.value||a.value===b)a.value=b,dojo.addClass(a,"placeholder_text")}})}}}}(this,this.document);dojo.addOnLoad(function(){FORMALIZE.go()})
19 assets/js/extjs.formalize.js
@@ -97,16 +97,15 @@ var FORMALIZE = (function(window, document, undefined) {
97 97 FORMALIZE.misc.add_placeholder();
98 98
99 99 Ext.each(Ext.query('[placeholder]'), function(el) {
  100 + // Placeholder obscured in older browsers,
  101 + // so there's no point adding to password.
  102 + if (el.type === 'password') {
  103 + return;
  104 + }
  105 +
100 106 var text = el.getAttribute('placeholder');
101 107 var form = Ext.get(el).parent('form');
102 108
103   - function add_placeholder() {
104   - if (!el.value || el.value === text) {
105   - el.value = text;
106   - Ext.get(el).addClass('placeholder_text');
107   - }
108   - }
109   -
110 109 Ext.get(el).on('focus', function() {
111 110 if (el.value === text) {
112 111 el.value = '';
@@ -144,6 +143,12 @@ var FORMALIZE = (function(window, document, undefined) {
144 143 }
145 144
146 145 Ext.each(Ext.query('[placeholder]'), function(el) {
  146 + // Placeholder obscured in older browsers,
  147 + // so there's no point adding to password.
  148 + if (el.type === 'password') {
  149 + return;
  150 + }
  151 +
147 152 var text = el.getAttribute('placeholder');
148 153
149 154 if (!el.value || el.value === text) {
2  assets/js/extjs.formalize.min.js
... ... @@ -1 +1 @@
1   -var FORMALIZE=function(a,b){var c="placeholder"in b.createElement("input"),d="autofocus"in b.createElement("input"),e=Ext.isIE6,f=Ext.isIE7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){f&&Ext.query("textarea, input.input_full")&&Ext.each(Ext.query("textarea, input.input_full"),function(a){Ext.get(a).wrap('<span class="input_full_wrap"></span>')})},ie6_skin_inputs:function(){if(e&&Ext.query("input, select, textarea")){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;Ext.each(Ext.query("input"),function(c){c.getAttribute("type").match(a)?(Ext.get(c).addClass("ie6_button"),c.disabled&&Ext.get(c).addClass("ie6_button_disabled")):c.getAttribute("type").match(b)&&(Ext.get(c).addClass("ie6_input"),c.disabled&&Ext.get(c).addClass("ie6_input_disabled"))}),Ext.each(Ext.query("textarea, select"),function(a){a.disabled&&Ext.get(a).addClass("ie6_input_disabled")})}},autofocus:function(){d||!Ext.query("[autofocus]")||Ext.query("[autofocus]")[0].focus()},placeholder:function(){!c&&!!Ext.query("[placeholder]")&&(FORMALIZE.misc.add_placeholder(),Ext.each(Ext.query("[placeholder]"),function(a){var b=a.getAttribute("placeholder"),c=Ext.get(a).parent("form");Ext.get(a).on("focus",function(){a.value===b&&(a.value="",Ext.get(a).removeClass("placeholder_text"))}),Ext.get(a).on("blur",function(){FORMALIZE.misc.add_placeholder()}),c.on("submit",function(){a.value===b&&(a.value="",Ext.get(a).removeClass("placeholder_text"))}),c.on("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){c||!Ext.query("[placeholder]")||Ext.each(Ext.query("[placeholder]"),function(a){var b=a.getAttribute("placeholder");if(!a.value||a.value===b)a.value=b,Ext.get(a).addClass("placeholder_text")})}}}}(this,this.document);Ext.onReady(function(){FORMALIZE.go()})
  1 +var FORMALIZE=function(a,b){var c="placeholder"in b.createElement("input"),d="autofocus"in b.createElement("input"),e=Ext.isIE6,f=Ext.isIE7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){f&&Ext.query("textarea, input.input_full")&&Ext.each(Ext.query("textarea, input.input_full"),function(a){Ext.get(a).wrap('<span class="input_full_wrap"></span>')})},ie6_skin_inputs:function(){if(e&&Ext.query("input, select, textarea")){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;Ext.each(Ext.query("input"),function(c){c.getAttribute("type").match(a)?(Ext.get(c).addClass("ie6_button"),c.disabled&&Ext.get(c).addClass("ie6_button_disabled")):c.getAttribute("type").match(b)&&(Ext.get(c).addClass("ie6_input"),c.disabled&&Ext.get(c).addClass("ie6_input_disabled"))}),Ext.each(Ext.query("textarea, select"),function(a){a.disabled&&Ext.get(a).addClass("ie6_input_disabled")})}},autofocus:function(){d||!Ext.query("[autofocus]")||Ext.query("[autofocus]")[0].focus()},placeholder:function(){!c&&!!Ext.query("[placeholder]")&&(FORMALIZE.misc.add_placeholder(),Ext.each(Ext.query("[placeholder]"),function(a){if(a.type!=="password"){var b=a.getAttribute("placeholder"),c=Ext.get(a).parent("form");Ext.get(a).on("focus",function(){a.value===b&&(a.value="",Ext.get(a).removeClass("placeholder_text"))}),Ext.get(a).on("blur",function(){FORMALIZE.misc.add_placeholder()}),c.on("submit",function(){a.value===b&&(a.value="",Ext.get(a).removeClass("placeholder_text"))}),c.on("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}}))}},misc:{add_placeholder:function(){c||!Ext.query("[placeholder]")||Ext.each(Ext.query("[placeholder]"),function(a){if(a.type!=="password"){var b=a.getAttribute("placeholder");if(!a.value||a.value===b)a.value=b,Ext.get(a).addClass("placeholder_text")}})}}}}(this,this.document);Ext.onReady(function(){FORMALIZE.go()})
12 assets/js/jquery.formalize.js
@@ -97,6 +97,12 @@ var FORMALIZE = (function($, window, document, undefined) {
97 97 FORMALIZE.misc.add_placeholder();
98 98
99 99 $(':input[placeholder]').each(function() {
  100 + // Placeholder obscured in older browsers,
  101 + // so there's no point adding to password.
  102 + if (this.type === 'password') {
  103 + return;
  104 + }
  105 +
100 106 var el = $(this);
101 107 var text = el.attr('placeholder');
102 108
@@ -131,6 +137,12 @@ var FORMALIZE = (function($, window, document, undefined) {
131 137 }
132 138
133 139 $(':input[placeholder]').each(function() {
  140 + // Placeholder obscured in older browsers,
  141 + // so there's no point adding to password.
  142 + if (this.type === 'password') {
  143 + return;
  144 + }
  145 +
134 146 var el = $(this);
135 147 var text = el.attr('placeholder');
136 148
2  assets/js/jquery.formalize.min.js
... ... @@ -1 +1 @@
1   -var FORMALIZE=function(a,b,c){var d="placeholder"in c.createElement("input"),e="autofocus"in c.createElement("input"),f=!!a.browser.msie&&parseInt(a.browser.version,10)===6,g=!!a.browser.msie&&parseInt(a.browser.version,10)===7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){g&&a("textarea, input.input_full").length&&a("textarea, input.input_full").wrap('<span class="input_full_wrap"></span>')},ie6_skin_inputs:function(){if(f&&a("input, select, textarea").length){var b=/button|submit|reset/,c=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;a("input").each(function(){var d=a(this);this.getAttribute("type").match(b)?(d.addClass("ie6_button"),this.disabled&&d.addClass("ie6_button_disabled")):this.getAttribute("type").match(c)&&(d.addClass("ie6_input"),this.disabled&&d.addClass("ie6_input_disabled"))}),a("textarea, select").each(function(){this.disabled&&a(this).addClass("ie6_input_disabled")})}},autofocus:function(){e||!a(":input[autofocus]").length||a(":input[autofocus]:visible:first").focus()},placeholder:function(){!d&&!!a(":input[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),a(":input[placeholder]").each(function(){var b=a(this),c=b.attr("placeholder");b.focus(function(){b.val()===c&&b.val("").removeClass("placeholder_text")}).blur(function(){FORMALIZE.misc.add_placeholder()}),b.closest("form").submit(function(){b.val()===c&&b.val("").removeClass("placeholder_text")}).bind("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){d||!a(":input[placeholder]").length||a(":input[placeholder]").each(function(){var b=a(this),c=b.attr("placeholder");(!b.val()||b.val()===c)&&b.val(c).addClass("placeholder_text")})}}}}(jQuery,this,this.document);jQuery(document).ready(function(){FORMALIZE.go()})
  1 +var FORMALIZE=function(a,b,c){var d="placeholder"in c.createElement("input"),e="autofocus"in c.createElement("input"),f=!!a.browser.msie&&parseInt(a.browser.version,10)===6,g=!!a.browser.msie&&parseInt(a.browser.version,10)===7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){g&&a("textarea, input.input_full").length&&a("textarea, input.input_full").wrap('<span class="input_full_wrap"></span>')},ie6_skin_inputs:function(){if(f&&a("input, select, textarea").length){var b=/button|submit|reset/,c=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;a("input").each(function(){var d=a(this);this.getAttribute("type").match(b)?(d.addClass("ie6_button"),this.disabled&&d.addClass("ie6_button_disabled")):this.getAttribute("type").match(c)&&(d.addClass("ie6_input"),this.disabled&&d.addClass("ie6_input_disabled"))}),a("textarea, select").each(function(){this.disabled&&a(this).addClass("ie6_input_disabled")})}},autofocus:function(){e||!a(":input[autofocus]").length||a(":input[autofocus]:visible:first").focus()},placeholder:function(){!d&&!!a(":input[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),a(":input[placeholder]").each(function(){if(this.type!=="password"){var b=a(this),c=b.attr("placeholder");b.focus(function(){b.val()===c&&b.val("").removeClass("placeholder_text")}).blur(function(){FORMALIZE.misc.add_placeholder()}),b.closest("form").submit(function(){b.val()===c&&b.val("").removeClass("placeholder_text")}).bind("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}}))}},misc:{add_placeholder:function(){d||!a(":input[placeholder]").length||a(":input[placeholder]").each(function(){if(this.type!=="password"){var b=a(this),c=b.attr("placeholder");(!b.val()||b.val()===c)&&b.val(c).addClass("placeholder_text")}})}}}}(jQuery,this,this.document);jQuery(document).ready(function(){FORMALIZE.go()})
12 assets/js/mootools.formalize.js
@@ -98,6 +98,12 @@ var FORMALIZE = (function(window, document, undefined) {
98 98 FORMALIZE.misc.add_placeholder();
99 99
100 100 $$('[placeholder]').each(function(el) {
  101 + // Placeholder obscured in older browsers,
  102 + // so there's no point adding to password.
  103 + if (el.type === 'password') {
  104 + return;
  105 + }
  106 +
101 107 var text = el.get('placeholder');
102 108
103 109 el.addEvents({
@@ -139,6 +145,12 @@ var FORMALIZE = (function(window, document, undefined) {
139 145 }
140 146
141 147 $$('[placeholder]').each(function(el) {
  148 + // Placeholder obscured in older browsers,
  149 + // so there's no point adding to password.
  150 + if (el.type === 'password') {
  151 + return;
  152 + }
  153 +
142 154 var text = el.get('placeholder');
143 155
144 156 if (!el.value || el.value === text) {
2  assets/js/mootools.formalize.min.js
... ... @@ -1 +1 @@
1   -var FORMALIZE=function(a,b){var c="placeholder"in b.createElement("input"),d="autofocus"in b.createElement("input"),e=Browser.ie6,f=Browser.ie7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){f&&$$("textarea, input.input_full").length&&$$("textarea, input.input_full").each(function(a){(new Element("span.input_full_wrap")).wraps(a)})},ie6_skin_inputs:function(){if(e&&$$("input, select, textarea").length){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;$$("input").each(function(c){c.getAttribute("type").match(a)?(c.addClass("ie6_button"),c.disabled&&c.addClass("ie6_button_disabled")):c.getAttribute("type").match(b)&&(c.addClass("ie6_input"),c.disabled&&c.addClass("ie6_input_disabled"))}),$$("textarea, select").each(function(a){a.disabled&&a.addClass("ie6_input_disabled")})}},autofocus:function(){d||!$$("[autofocus]").length||$$("[autofocus]")[0].focus()},placeholder:function(){!c&&!!$$("[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),$$("[placeholder]").each(function(a){var b=a.get("placeholder");a.addEvents({focus:function(){a.value===b&&a.set("value","").removeClass("placeholder_text")},blur:function(){FORMALIZE.misc.add_placeholder()}});var c=a.getParent("form");c&&c.addEvents({submit:function(){a.value===b&&a.set("value","").removeClass("placeholder_text")},reset:function(){setTimeout(FORMALIZE.misc.add_placeholder,50)}})}))}},misc:{add_placeholder:function(){c||!$$("[placeholder]").length||$$("[placeholder]").each(function(a){var b=a.get("placeholder");(!a.value||a.value===b)&&a.set("value",b).addClass("placeholder_text")})}}}}(this,this.document);$(document).addEvent("domready",function(){FORMALIZE.go()})
  1 +var FORMALIZE=function(a,b){var c="placeholder"in b.createElement("input"),d="autofocus"in b.createElement("input"),e=Browser.ie6,f=Browser.ie7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){f&&$$("textarea, input.input_full").length&&$$("textarea, input.input_full").each(function(a){(new Element("span.input_full_wrap")).wraps(a)})},ie6_skin_inputs:function(){if(e&&$$("input, select, textarea").length){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;$$("input").each(function(c){c.getAttribute("type").match(a)?(c.addClass("ie6_button"),c.disabled&&c.addClass("ie6_button_disabled")):c.getAttribute("type").match(b)&&(c.addClass("ie6_input"),c.disabled&&c.addClass("ie6_input_disabled"))}),$$("textarea, select").each(function(a){a.disabled&&a.addClass("ie6_input_disabled")})}},autofocus:function(){d||!$$("[autofocus]").length||$$("[autofocus]")[0].focus()},placeholder:function(){!c&&!!$$("[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),$$("[placeholder]").each(function(a){if(a.type!=="password"){var b=a.get("placeholder");a.addEvents({focus:function(){a.value===b&&a.set("value","").removeClass("placeholder_text")},blur:function(){FORMALIZE.misc.add_placeholder()}});var c=a.getParent("form");c&&c.addEvents({submit:function(){a.value===b&&a.set("value","").removeClass("placeholder_text")},reset:function(){setTimeout(FORMALIZE.misc.add_placeholder,50)}})}}))}},misc:{add_placeholder:function(){c||!$$("[placeholder]").length||$$("[placeholder]").each(function(a){if(a.type!=="password"){var b=a.get("placeholder");(!a.value||a.value===b)&&a.set("value",b).addClass("placeholder_text")}})}}}}(this,this.document);$(document).addEvent("domready",function(){FORMALIZE.go()})
12 assets/js/prototype.formalize.js
@@ -104,6 +104,12 @@ var FORMALIZE = (function(window, document, undefined) {
104 104 FORMALIZE.misc.add_placeholder();
105 105
106 106 $$('[placeholder]').each(function(el) {
  107 + // Placeholder obscured in older browsers,
  108 + // so there's no point adding to password.
  109 + if (el.type === 'password') {
  110 + return;
  111 + }
  112 +
107 113 var text = el.getAttribute('placeholder');
108 114 var form = el.up('form');
109 115
@@ -144,6 +150,12 @@ var FORMALIZE = (function(window, document, undefined) {
144 150 }
145 151
146 152 $$('[placeholder]').each(function(el) {
  153 + // Placeholder obscured in older browsers,
  154 + // so there's no point adding to password.
  155 + if (el.type === 'password') {
  156 + return;
  157 + }
  158 +
147 159 var text = el.getAttribute('placeholder');
148 160
149 161 if (!el.value || el.value === text) {
2  assets/js/prototype.formalize.min.js
... ... @@ -1 +1 @@
1   -var FORMALIZE=function(a,b){function c(a){var c=b.createElement("b");return c.innerHTML="<!--[if IE "+a+"]><br><![endif]-->",!!c.getElementsByTagName("br").length}var d="placeholder"in b.createElement("input"),e="autofocus"in b.createElement("input"),f=c(6),g=c(7);return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){g&&$$("textarea, input.input_full").length&&$$("textarea, input.input_full").each(function(a){Element.wrap(a,"span",{"class":"input_full_wrap"})})},ie6_skin_inputs:function(){if(f&&$$("input, select, textarea").length){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;$$("input").each(function(c){c.getAttribute("type").match(a)?(c.addClassName("ie6_button"),c.disabled&&c.addClassName("ie6_button_disabled")):c.getAttribute("type").match(b)&&(c.addClassName("ie6_input"),c.disabled&&c.addClassName("ie6_input_disabled"))}),$$("textarea, select").each(function(a){a.disabled&&a.addClassName("ie6_input_disabled")})}},autofocus:function(){e||!$$("[autofocus]").length||$$("[autofocus]")[0].focus()},placeholder:function(){!d&&!!$$("[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),$$("[placeholder]").each(function(a){var b=a.getAttribute("placeholder"),c=a.up("form");a.observe("focus",function(){a.value===b&&(a.value="",a.removeClassName("placeholder_text"))}),a.observe("blur",function(){FORMALIZE.misc.add_placeholder()}),c.observe("submit",function(){a.value===b&&(a.value="",a.removeClassName("placeholder_text"))}),c.observe("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){d||!$$("[placeholder]").length||$$("[placeholder]").each(function(a){var b=a.getAttribute("placeholder");if(!a.value||a.value===b)a.value=b,a.addClassName("placeholder_text")})}}}}(this,this.document);$(document).observe("dom:loaded",function(){FORMALIZE.go()})
  1 +var FORMALIZE=function(a,b){function c(a){var c=b.createElement("b");return c.innerHTML="<!--[if IE "+a+"]><br><![endif]-->",!!c.getElementsByTagName("br").length}var d="placeholder"in b.createElement("input"),e="autofocus"in b.createElement("input"),f=c(6),g=c(7);return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){g&&$$("textarea, input.input_full").length&&$$("textarea, input.input_full").each(function(a){Element.wrap(a,"span",{"class":"input_full_wrap"})})},ie6_skin_inputs:function(){if(f&&$$("input, select, textarea").length){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;$$("input").each(function(c){c.getAttribute("type").match(a)?(c.addClassName("ie6_button"),c.disabled&&c.addClassName("ie6_button_disabled")):c.getAttribute("type").match(b)&&(c.addClassName("ie6_input"),c.disabled&&c.addClassName("ie6_input_disabled"))}),$$("textarea, select").each(function(a){a.disabled&&a.addClassName("ie6_input_disabled")})}},autofocus:function(){e||!$$("[autofocus]").length||$$("[autofocus]")[0].focus()},placeholder:function(){!d&&!!$$("[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),$$("[placeholder]").each(function(a){if(a.type!=="password"){var b=a.getAttribute("placeholder"),c=a.up("form");a.observe("focus",function(){a.value===b&&(a.value="",a.removeClassName("placeholder_text"))}),a.observe("blur",function(){FORMALIZE.misc.add_placeholder()}),c.observe("submit",function(){a.value===b&&(a.value="",a.removeClassName("placeholder_text"))}),c.observe("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}}))}},misc:{add_placeholder:function(){d||!$$("[placeholder]").length||$$("[placeholder]").each(function(a){if(a.type!=="password"){var b=a.getAttribute("placeholder");if(!a.value||a.value===b)a.value=b,a.addClassName("placeholder_text")}})}}}}(this,this.document);$(document).observe("dom:loaded",function(){FORMALIZE.go()})
12 assets/js/yui.formalize.js
@@ -96,6 +96,12 @@ YUI.add('formalize', function(Y) {
96 96 Y.formalize.misc.add_placeholder();
97 97
98 98 Y.all('[placeholder]').each(function(el) {
  99 + // Placeholder obscured in older browsers,
  100 + // so there's no point adding to password.
  101 + if (el.type === 'password') {
  102 + return;
  103 + }
  104 +
99 105 var text = el.getAttribute('placeholder');
100 106 var form = el.ancestor('form');
101 107
@@ -140,6 +146,12 @@ YUI.add('formalize', function(Y) {
140 146 }
141 147
142 148 Y.all('[placeholder]').each(function(el) {
  149 + // Placeholder obscured in older browsers,
  150 + // so there's no point adding to password.
  151 + if (el.type === 'password') {
  152 + return;
  153 + }
  154 +
143 155 var text = el.getAttribute('placeholder');
144 156
145 157 if (!el.get('value') || el.get('value') === text) {
2  assets/js/yui.formalize.min.js
... ... @@ -1 +1 @@
1   -YUI.add("formalize",function(a){var b="placeholder"in document.createElement("input"),c="autofocus"in document.createElement("input"),d=parseInt(a.UA.ie,10)===6,e=parseInt(a.UA.ie,10)===7;a.formalize={go:function(){for(var b in a.formalize.init)a.formalize.init[b]()},init:{full_input_size:function(){e&&a.all("textarea, input.input_full")&&a.all("textarea, input.input_full").each(function(b){var c=a.Node.create('<span class="input_full_wrap"></span>');c.append(b.replace(c))})},ie6_skin_inputs:function(){if(d&&a.all("input, select, textarea")){var b=/button|submit|reset/,c=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;a.all("input").each(function(a){a.getAttribute("type").match(b)?(a.addClass("ie6_button"),a.disabled&&a.addClass("ie6_button_disabled")):a.getAttribute("type").match(c)&&(a.addClass("ie6_input"),a.disabled&&a.addClass("ie6_input_disabled"))}),a.all("textarea, select").each(function(a){a.disabled&&a.addClass("ie6_input_disabled")})}},autofocus:function(){c||!a.one("[autofocus]")||a.one("[autofocus]").focus()},placeholder:function(){!b&&!!a.one("[placeholder]")&&(a.formalize.misc.add_placeholder(),a.all("[placeholder]").each(function(b){var c=b.getAttribute("placeholder"),d=b.ancestor("form");b.on("focus",function(){b.get("value")===c&&b.set("value","").removeClass("placeholder_text")}),b.on("blur",function(){a.formalize.misc.add_placeholder()}),d&&d.on("submit",function(){b.get("value")===c&&b.set("value","").removeClass("placeholder_text")}),d&&d.on("reset",function(){setTimeout(a.formalize.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){b||!a.one("[placeholder]")||a.all("[placeholder]").each(function(a){var b=a.getAttribute("placeholder");(!a.get("value")||a.get("value")===b)&&a.set("value",b).addClass("placeholder_text")})}}}},"1.1",{requires:["node","event"]})
  1 +YUI.add("formalize",function(a){var b="placeholder"in document.createElement("input"),c="autofocus"in document.createElement("input"),d=parseInt(a.UA.ie,10)===6,e=parseInt(a.UA.ie,10)===7;a.formalize={go:function(){for(var b in a.formalize.init)a.formalize.init[b]()},init:{full_input_size:function(){e&&a.all("textarea, input.input_full")&&a.all("textarea, input.input_full").each(function(b){var c=a.Node.create('<span class="input_full_wrap"></span>');c.append(b.replace(c))})},ie6_skin_inputs:function(){if(d&&a.all("input, select, textarea")){var b=/button|submit|reset/,c=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;a.all("input").each(function(a){a.getAttribute("type").match(b)?(a.addClass("ie6_button"),a.disabled&&a.addClass("ie6_button_disabled")):a.getAttribute("type").match(c)&&(a.addClass("ie6_input"),a.disabled&&a.addClass("ie6_input_disabled"))}),a.all("textarea, select").each(function(a){a.disabled&&a.addClass("ie6_input_disabled")})}},autofocus:function(){c||!a.one("[autofocus]")||a.one("[autofocus]").focus()},placeholder:function(){!b&&!!a.one("[placeholder]")&&(a.formalize.misc.add_placeholder(),a.all("[placeholder]").each(function(b){if(b.type!=="password"){var c=b.getAttribute("placeholder"),d=b.ancestor("form");b.on("focus",function(){b.get("value")===c&&b.set("value","").removeClass("placeholder_text")}),b.on("blur",function(){a.formalize.misc.add_placeholder()}),d&&d.on("submit",function(){b.get("value")===c&&b.set("value","").removeClass("placeholder_text")}),d&&d.on("reset",function(){setTimeout(a.formalize.misc.add_placeholder,50)})}}))}},misc:{add_placeholder:function(){b||!a.one("[placeholder]")||a.all("[placeholder]").each(function(a){if(a.type!=="password"){var b=a.getAttribute("placeholder");(!a.get("value")||a.get("value")===b)&&a.set("value",b).addClass("placeholder_text")}})}}}},"1.1",{requires:["node","event"]})
6 dojo_demo.html
@@ -121,11 +121,11 @@
121 121 <input type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label for="text">
125   - Text
  124 + <label for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input type="text" id="text" name="text" />
  128 + <input type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 dojo_disabled.html
@@ -121,11 +121,11 @@
121 121 <input disabled="disabled" type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label for="text">
125   - Text
  124 + <label for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input disabled="disabled" type="text" id="text" name="text" />
  128 + <input disabled="disabled" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 dojo_errors.html
@@ -121,11 +121,11 @@
121 121 <input class="error" type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label class="error" for="text">
125   - Text
  124 + <label class="error" for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input class="error" type="text" id="text" name="text" />
  128 + <input class="error" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 extjs_demo.html
@@ -121,11 +121,11 @@
121 121 <input type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label for="text">
125   - Text
  124 + <label for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input type="text" id="text" name="text" />
  128 + <input type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 extjs_disabled.html
@@ -121,11 +121,11 @@
121 121 <input disabled="disabled" type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label for="text">
125   - Text
  124 + <label for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input disabled="disabled" type="text" id="text" name="text" />
  128 + <input disabled="disabled" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 extjs_errors.html
@@ -121,11 +121,11 @@
121 121 <input class="error" type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label class="error" for="text">
125   - Text
  124 + <label class="error" for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input class="error" type="text" id="text" name="text" />
  128 + <input class="error" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 jquery_demo.html
@@ -121,11 +121,11 @@
121 121 <input type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label for="text">
125   - Text
  124 + <label for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input type="text" id="text" name="text" />
  128 + <input type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 jquery_disabled.html
@@ -121,11 +121,11 @@
121 121 <input disabled="disabled" type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label for="text">
125   - Text
  124 + <label for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input disabled="disabled" type="text" id="text" name="text" />
  128 + <input disabled="disabled" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 jquery_errors.html
@@ -121,11 +121,11 @@
121 121 <input class="error" type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label class="error" for="text">
125   - Text
  124 + <label class="error" for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input class="error" type="text" id="text" name="text" />
  128 + <input class="error" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 mootools_demo.html
@@ -121,11 +121,11 @@
121 121 <input type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label for="text">
125   - Text
  124 + <label for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input type="text" id="text" name="text" />
  128 + <input type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 mootools_disabled.html
@@ -121,11 +121,11 @@
121 121 <input disabled="disabled" type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label for="text">
125   - Text
  124 + <label for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input disabled="disabled" type="text" id="text" name="text" />
  128 + <input disabled="disabled" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 mootools_errors.html
@@ -121,11 +121,11 @@
121 121 <input class="error" type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label class="error" for="text">
125   - Text
  124 + <label class="error" for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input class="error" type="text" id="text" name="text" />
  128 + <input class="error" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 prototype_demo.html
@@ -121,11 +121,11 @@
121 121 <input type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label for="text">
125   - Text
  124 + <label for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input type="text" id="text" name="text" />
  128 + <input type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 prototype_disabled.html
@@ -121,11 +121,11 @@
121 121 <input disabled="disabled" type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label for="text">
125   - Text
  124 + <label for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input disabled="disabled" type="text" id="text" name="text" />
  128 + <input disabled="disabled" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 prototype_errors.html
@@ -121,11 +121,11 @@
121 121 <input class="error" type="email" id="email" name="email" placeholder="name@example.com" />
122 122 </td>
123 123 <td>
124   - <label class="error" for="text">
125   - Text
  124 + <label class="error" for="password">
  125 + Password
126 126 </label>
127 127 <br />
128   - <input class="error" type="text" id="text" name="text" />
  128 + <input class="error" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
129 129 </td>
130 130 </tr>
131 131 <tr>
6 unstyled.html
@@ -118,11 +118,11 @@
118 118 <input type="email" id="email" name="email" placeholder="name@example.com" />
119 119 </td>
120 120 <td>
121   - <label for="text">
122   - Text
  121 + <label for="password">
  122 + Password
123 123 </label>
124 124 <br />
125   - <input type="text" id="text" name="text" />
  125 + <input type="password" id="password" name="password" placeholder="Alphanumeric123!" />
126 126 </td>
127 127 </tr>
128 128 <tr>
6 yui_demo.html
@@ -129,11 +129,11 @@
129 129 <input type="email" id="email" name="email" placeholder="name@example.com" />
130 130 </td>
131 131 <td>
132   - <label for="text">
133   - Text
  132 + <label for="password">
  133 + Password
134 134 </label>
135 135 <br />
136   - <input type="text" id="text" name="text" />
  136 + <input type="password" id="password" name="password" placeholder="Alphanumeric123!" />
137 137 </td>
138 138 </tr>
139 139 <tr>
6 yui_disabled.html
@@ -129,11 +129,11 @@
129 129 <input disabled="disabled" type="email" id="email" name="email" placeholder="name@example.com" />
130 130 </td>
131 131 <td>
132   - <label for="text">
133   - Text
  132 + <label for="password">
  133 + Password
134 134 </label>
135 135 <br />
136   - <input disabled="disabled" type="text" id="text" name="text" />
  136 + <input disabled="disabled" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
137 137 </td>
138 138 </tr>
139 139 <tr>
6 yui_errors.html
@@ -129,11 +129,11 @@
129 129 <input class="error" type="email" id="email" name="email" placeholder="name@example.com" />
130 130 </td>
131 131 <td>
132   - <label class="error" for="text">
133   - Text
  132 + <label class="error" for="password">
  133 + Password
134 134 </label>
135 135 <br />
136   - <input class="error" type="text" id="text" name="text" />
  136 + <input class="error" type="password" id="password" name="password" placeholder="Alphanumeric123!" />
137 137 </td>
138 138 </tr>
139 139 <tr>

0 comments on commit 0e12ea7

Please sign in to comment.
Something went wrong with that request. Please try again.