From 7ec7d879ee20e9bf1dec618ec701fba3982a44b0 Mon Sep 17 00:00:00 2001 From: Marius Hoch Date: Fri, 26 Jul 2013 19:23:52 +0200 Subject: [PATCH] jquery.placeholder: Fixup for a8145d6fa2 * add release notes * fix minor bug where wrong value is used Change-Id: Iaab38cc041d143228332e00092f8521f6f3de596 --- RELEASE-NOTES-1.22 | 2 ++ resources/jquery/jquery.placeholder.js | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index 0d4bee79e8..2658193461 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -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 diff --git a/resources/jquery/jquery.placeholder.js b/resources/jquery/jquery.placeholder.js index 73f701b507..f7c9ae0f29 100644 --- a/resources/jquery/jquery.placeholder.js +++ b/resources/jquery/jquery.placeholder.js @@ -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 -- 2.20.1