[Jifty-commit] r4643 - in jifty/trunk: share/web/static/js
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Dec 7 16:24:32 EST 2007
Author: sartak
Date: Fri Dec 7 16:24:31 2007
New Revision: 4643
Modified:
jifty/trunk/ (props changed)
jifty/trunk/share/web/static/js/jifty.js
Log:
r48766 at onn: sartak | 2007-12-07 16:24:11 -0500
jifty.js: Work around placeholders not being properly cleared and causing (small) data loss
Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js (original)
+++ jifty/trunk/share/web/static/js/jifty.js Fri Dec 7 16:24:31 2007
@@ -1447,6 +1447,8 @@
initialize: function(element, text) {
this.element = $(element);
this.text = text;
+ this.element.placeholderText = this.text;
+
Event.observe(element, 'focus', this.onFocus.bind(this));
Event.observe(element, 'blur', this.onBlur.bind(this));
this.onBlur();
@@ -1486,7 +1488,10 @@
},
clearPlaceholder: function(elt) {
- if(Jifty.Placeholder.hasPlaceholder(elt)) {
+ // If the element's text isn't the same as its placeholder text, then the
+ // browser screwed up and didn't clear our placeholder. Opera on Mac with
+ // VirtueDesktops does this some times, and I lose data.
+ if(Jifty.Placeholder.hasPlaceholder(elt) && elt.value == elt.placeholderText) {
elt.value = '';
Element.removeClassName(elt, 'placeholder');
}
More information about the Jifty-commit
mailing list