Remove code for "placeholder" attribute support in old browsers

pull/5393/head^2
Aleksander Machniak 8 years ago
parent c88a88fb0b
commit de5da687e4

@ -936,9 +936,6 @@ function rcube_webmail()
input.focus();
break;
}
// clear empty input fields
$('input.placeholder').each(function(){ if (this.value == this._placeholder) this.value = ''; });
}
// add selected source (on the list)

@ -613,39 +613,10 @@ jQuery.last = function(arr) {
return arr && arr.length ? arr[arr.length-1] : undefined;
}
// jQuery plugin to emulate HTML5 placeholder attributes on input elements
// jQuery plugin to set HTML5 placeholder and title attributes on input elements
jQuery.fn.placeholder = function(text) {
return this.each(function() {
var active = false, elem = $(this);
this.title = text;
// Try HTML5 placeholder attribute first
if ('placeholder' in this) {
elem.attr('placeholder', text);
}
// Fallback to Javascript emulation of placeholder
else {
this._placeholder = text;
elem.blur(function(e) {
if ($.trim(elem.val()) == "")
elem.val(text);
elem.triggerHandler('change');
})
.focus(function(e) {
if ($.trim(elem.val()) == text)
elem.val("");
elem.triggerHandler('change');
})
.change(function(e) {
var active = elem.val() == text;
elem[(active ? 'addClass' : 'removeClass')]('placeholder').attr('spellcheck', active);
});
// Do not blur currently focused element (catch exception: #1489008)
try { active = this == document.activeElement; } catch(e) {}
if (!active)
elem.blur();
}
$(this).prop({title: text, placeholder: text});
});
};

Loading…
Cancel
Save