jquery.placeholder: Fixup for a8145d6fa2

* add release notes
* fix minor bug where wrong value is used

Change-Id: Iaab38cc041d143228332e00092f8521f6f3de596
This commit is contained in:
Marius Hoch 2013-07-26 19:23:52 +02:00 committed by Krinkle
parent c5af7003c2
commit 7ec7d879ee
2 changed files with 6 additions and 6 deletions

View file

@ -163,6 +163,8 @@ production.
The special page form received a new checkbox matching that option.
* (bug 23580) Implement javascript callback interface "mw.hook".
* (bug 30713) New mw.hook "wikipage.content".
* (bug 40430) jquery.placeholder gets a new parameter to set the attribute value
to be used.
=== Bug fixes in 1.22 ===
* Disable Special:PasswordReset when $wgEnableEmail is false. Previously one

View file

@ -11,22 +11,20 @@
( function ( $ ) {
$.fn.placeholder = function ( text ) {
// Check whether supplied argument is a string
var textIsValid = ( typeof text === 'string' );
return this.each( function () {
var placeholder, $input;
if ( arguments.length ) {
this.setAttribute( 'placeholder', text );
}
// If the HTML5 placeholder attribute is supported, use it
if ( this.placeholder && 'placeholder' in document.createElement( this.tagName ) ) {
if ( textIsValid ) {
this.setAttribute( 'placeholder', text );
}
return;
}
placeholder = textIsValid ? text : this.getAttribute( 'placeholder' );
placeholder = arguments.length ? text : this.getAttribute( 'placeholder' );
$input = $(this);
// Show initially, if empty