Henning Snater has uploaded a new change for review.
https://gerrit.wikimedia.org/r/51658
Change subject: $.eachchange: Include input elements without type attribute
......................................................................
$.eachchange: Include input elements without type attribute
The "type" attribute is not required on input elements and defaults to "text".
Change-Id: Ia67b5aea6886bba460dff7535e2306234201624c
---
M DataTypes/resources/jquery/jquery.eachchange.js
M DataTypes/tests/qunit/jquery/jquery.eachchange.tests.js
2 files changed, 28 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues
refs/changes/58/51658/1
diff --git a/DataTypes/resources/jquery/jquery.eachchange.js
b/DataTypes/resources/jquery/jquery.eachchange.js
index d957c5d..498c662 100644
--- a/DataTypes/resources/jquery/jquery.eachchange.js
+++ b/DataTypes/resources/jquery/jquery.eachchange.js
@@ -59,7 +59,7 @@
};
// works for text input fields and textarea only:
- this.filter( 'input:text, textarea' ).each( function() {
+ this.filter( 'input:text, input:not([type]), textarea' ).each(
function() {
var input = $( this );
monitorEachChange( input );
diff --git a/DataTypes/tests/qunit/jquery/jquery.eachchange.tests.js
b/DataTypes/tests/qunit/jquery/jquery.eachchange.tests.js
index c9c3909..570ef9d 100644
--- a/DataTypes/tests/qunit/jquery/jquery.eachchange.tests.js
+++ b/DataTypes/tests/qunit/jquery/jquery.eachchange.tests.js
@@ -37,6 +37,33 @@
}
} ) );
+ QUnit.test(
+ 'Initialization',
+ function( assert ) {
+ var $input = $( '<input/>', { 'class':
'test_eachchange', type: 'text' } ),
+ $inputNoType = $( '<input/>', { 'class':
'test_eachchange' } ),
+ $textarea = $( '<textarea/>', { 'class':
'test_eachchange' } );
+
+ assert.equal(
+ $input.eachchange( iIncr ),
+ $input,
+ 'Initialized "eachchange" on a text input
element.'
+ );
+
+ assert.equal(
+ $inputNoType.eachchange( iIncr ),
+ $inputNoType,
+ 'Initialized "eachchange" on an input element
that has no "type" attribute.'
+ );
+
+ assert.equal(
+ $textarea.eachchange( iIncr ),
+ $textarea,
+ 'Initialized "eachchange" on a textarea.'
+ );
+ }
+ );
+
QUnit.test( 'jQuery.eachchange() basics', function( assert ) {
var subject = $( '<input/>', {
'class': 'test_eachchange',
--
To view, visit https://gerrit.wikimedia.org/r/51658
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia67b5aea6886bba460dff7535e2306234201624c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits