Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/76239


Change subject: jquery.placeholder: Fixup for 7ec7d879ee
......................................................................

jquery.placeholder: Fixup for 7ec7d879ee

Check for 'arguments.length' was done in the wrong scope.
It checked for arguments to .each() which is always 2 (i, el).

This caused a regression where any call to .placeholder() without
arguments resulted in the string 'undefined' to be displayed as
placeholder (since it was doing setAttribute and passing it `text`
which is undefined, and then further using that undefined variable).

Until 7ec7d879ee / a8145d6fa2 this was the only way .placeholder
could be called, so this is a major regression affecting all use
of it.

Change-Id: I862b0f72548ec2122dad9c5d013149ac57688dab
---
M resources/jquery/jquery.placeholder.js
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/39/76239/1

diff --git a/resources/jquery/jquery.placeholder.js 
b/resources/jquery/jquery.placeholder.js
index f7c9ae0..8044d88 100644
--- a/resources/jquery/jquery.placeholder.js
+++ b/resources/jquery/jquery.placeholder.js
@@ -11,11 +11,12 @@
 ( function ( $ ) {
 
        $.fn.placeholder = function ( text ) {
+               var hasArg = arguments.length;
 
                return this.each( function () {
                        var placeholder, $input;
 
-                       if ( arguments.length ) {
+                       if ( hasArg ) {
                                this.setAttribute( 'placeholder', text );
                        }
 
@@ -24,7 +25,7 @@
                                return;
                        }
 
-                       placeholder = arguments.length ? text : 
this.getAttribute( 'placeholder' );
+                       placeholder = hasArg ? text : this.getAttribute( 
'placeholder' );
                        $input = $(this);
 
                        // Show initially, if empty

-- 
To view, visit https://gerrit.wikimedia.org/r/76239
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I862b0f72548ec2122dad9c5d013149ac57688dab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to