Krinkle has uploaded a new change for review.

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

Change subject: Use .prop() instead of .attr() where appropiate
......................................................................

Use .prop() instead of .attr() where appropiate

Like f02e8bb99a in VisualEditor.git

* The draggable content attribute was given boolean instead of
  string. This was casted internally. The property is an actual
  boolean.

The ARIA and role attributes are only appropiate as attributes,
and have no property equivalent and have no effect on the appearance
or behaviour of elements. Intended only for consumption by e.g.
selectors in stylesheets, and assistive technology.

Change-Id: I3d1b2a3d9511ab91acc32c078b85d05ff743d276
---
M src/Element.js
M src/Window.js
M src/mixins/AccessKeyedElement.js
M src/mixins/DraggableElement.js
M src/widgets/TextInputWidget.js
5 files changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/12/233112/1

diff --git a/src/Element.js b/src/Element.js
index 62c5328..101c1ab 100644
--- a/src/Element.js
+++ b/src/Element.js
@@ -40,7 +40,7 @@
                this.$element.addClass( config.classes.join( ' ' ) );
        }
        if ( config.id ) {
-               this.$element.attr( 'id', config.id );
+               this.$element.prop( 'id', config.id );
        }
        if ( config.text ) {
                this.$element.text( config.text );
diff --git a/src/Window.js b/src/Window.js
index 4cff430..8a11a15 100644
--- a/src/Window.js
+++ b/src/Window.js
@@ -64,7 +64,7 @@
        this.$overlay.addClass( 'oo-ui-window-overlay' );
        this.$content
                .addClass( 'oo-ui-window-content' )
-               .attr( 'tabindex', 0 );
+               .prop( 'tabIndex', 0 );
        this.$frame
                .addClass( 'oo-ui-window-frame' )
                .append( this.$content );
diff --git a/src/mixins/AccessKeyedElement.js b/src/mixins/AccessKeyedElement.js
index d672dab..c9bdb15 100644
--- a/src/mixins/AccessKeyedElement.js
+++ b/src/mixins/AccessKeyedElement.js
@@ -99,7 +99,7 @@
 /**
  * Get accesskey.
  *
- * @return {string} accessKey string
+ * @return {string|null} accessKey string
  */
 OO.ui.mixin.AccessKeyedElement.prototype.getAccessKey = function () {
        return this.accessKey;
diff --git a/src/mixins/DraggableElement.js b/src/mixins/DraggableElement.js
index 69a4d6e..4b2085e 100644
--- a/src/mixins/DraggableElement.js
+++ b/src/mixins/DraggableElement.js
@@ -15,7 +15,7 @@
 
        // Initialize and events
        this.$element
-               .attr( 'draggable', true )
+               .prop( 'draggable', true )
                .addClass( 'oo-ui-draggableElement' )
                .on( {
                        dragstart: this.onDragStart.bind( this ),
diff --git a/src/widgets/TextInputWidget.js b/src/widgets/TextInputWidget.js
index 4e0993b..95e2804 100644
--- a/src/widgets/TextInputWidget.js
+++ b/src/widgets/TextInputWidget.js
@@ -126,16 +126,16 @@
        this.setReadOnly( !!config.readOnly );
        this.updateSearchIndicator();
        if ( config.placeholder ) {
-               this.$input.attr( 'placeholder', config.placeholder );
+               this.$input.prop( 'placeholder', config.placeholder );
        }
        if ( config.maxLength !== undefined ) {
-               this.$input.attr( 'maxlength', config.maxLength );
+               this.$input.prop( 'maxLength', config.maxLength );
        }
        if ( config.autofocus ) {
-               this.$input.attr( 'autofocus', 'autofocus' );
+               this.$input.prop( 'autofocus', true );
        }
        if ( config.required ) {
-               this.$input.attr( 'required', 'required' );
+               this.$input.prop( 'required', true );
                this.$input.attr( 'aria-required', 'true' );
        }
        if ( config.autocomplete === false ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d1b2a3d9511ab91acc32c078b85d05ff743d276
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to