jenkins-bot has submitted this change and it was merged.
Change subject: jquery.placeholder: Take placeholder text as parameter
......................................................................
jquery.placeholder: Take placeholder text as parameter
After this change, it will be possible to supply the text to be used as
a placeholder to the plugIn. Instead of doing:
$('<input type="text" />').attr({
placeholder: "Placeholder text"
}).placeholder();
you can now simply do:
$('input#myInput')
.placeholder("Placeholder text");
after loading the plug-in.
Bug: 40430
Change-Id: I25255b2ef657f3215e64895d7905b984a1e9d59a
---
M resources/jquery/jquery.placeholder.js
1 file changed, 8 insertions(+), 2 deletions(-)
Approvals:
Hoo man: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/jquery/jquery.placeholder.js
b/resources/jquery/jquery.placeholder.js
index 7badb11..73f701b 100644
--- a/resources/jquery/jquery.placeholder.js
+++ b/resources/jquery/jquery.placeholder.js
@@ -10,17 +10,23 @@
*/
( function ( $ ) {
- $.fn.placeholder = 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 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 = this.getAttribute( 'placeholder' );
+ placeholder = textIsValid ? text : this.getAttribute(
'placeholder' );
$input = $(this);
// Show initially, if empty
--
To view, visit https://gerrit.wikimedia.org/r/74333
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I25255b2ef657f3215e64895d7905b984a1e9d59a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Rillke <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits