Bartosz Dziewoński has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/357325 )

Change subject: TabIndexedElement: Accept number-as-string in JS too
......................................................................

TabIndexedElement: Accept number-as-string in JS too

We accidentally allowed it in PHP, and it turns out we have usages
relying on it, so let's allow here too.

Minimal test case:

  widget = new OO.ui.TextInputWidget( { tabIndex: '42' } );
  $( 'body' ).append( widget.$element );

Bug: T167070
Change-Id: I3c9dc33585b9f5612372b9143f16ed4b433a4089
---
M src/mixins/TabIndexedElement.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/25/357325/1

diff --git a/src/mixins/TabIndexedElement.js b/src/mixins/TabIndexedElement.js
index 88c620a..84ce13a 100644
--- a/src/mixins/TabIndexedElement.js
+++ b/src/mixins/TabIndexedElement.js
@@ -85,7 +85,7 @@
  * @chainable
  */
 OO.ui.mixin.TabIndexedElement.prototype.setTabIndex = function ( tabIndex ) {
-       tabIndex = typeof tabIndex === 'number' ? tabIndex : null;
+       tabIndex = !isNaN( Number( tabIndex ) ) ? tabIndex : null;
 
        if ( this.tabIndex !== tabIndex ) {
                this.tabIndex = tabIndex;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c9dc33585b9f5612372b9143f16ed4b433a4089
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

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

Reply via email to