|
|
@ -720,10 +720,12 @@ jQuery.fn.placeholder = function(text) {
|
|
|
|
var elem = $(this);
|
|
|
|
var elem = $(this);
|
|
|
|
this.title = text;
|
|
|
|
this.title = text;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Try HTML5 placeholder attribute first
|
|
|
|
if ('placeholder' in this) {
|
|
|
|
if ('placeholder' in this) {
|
|
|
|
elem.attr('placeholder', text); // Try HTML5 placeholder attribute first
|
|
|
|
elem.attr('placeholder', text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { // Fallback to Javascript emulation of placeholder
|
|
|
|
// Fallback to Javascript emulation of placeholder
|
|
|
|
|
|
|
|
else {
|
|
|
|
this._placeholder = text;
|
|
|
|
this._placeholder = text;
|
|
|
|
elem.blur(function(e) {
|
|
|
|
elem.blur(function(e) {
|
|
|
|
if ($.trim(elem.val()) == "")
|
|
|
|
if ($.trim(elem.val()) == "")
|
|
|
@ -740,8 +742,13 @@ jQuery.fn.placeholder = function(text) {
|
|
|
|
elem[(active ? 'addClass' : 'removeClass')]('placeholder').attr('spellcheck', active);
|
|
|
|
elem[(active ? 'addClass' : 'removeClass')]('placeholder').attr('spellcheck', active);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (this != document.activeElement) // Do not blur currently focused element
|
|
|
|
// Do not blur currently focused element
|
|
|
|
elem.blur();
|
|
|
|
// Catch "unspecified error" in IE9 (#1489008)
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (this != document.activeElement)
|
|
|
|
|
|
|
|
elem.blur();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch(e) {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|