Bartosz Dziewoński has uploaded a new change for review.

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

Change subject: HTMLDateTimeField: Remove hacks for HTML5 form validation 
attributes
......................................................................

HTMLDateTimeField: Remove hacks for HTML5 form validation attributes

No longer needed after I08244addcf9b6eb96137895f28e7b750914fef5c.
Also remove datetime.js from mediawiki.htmlform module.

Change-Id: Ic2410c689de3f70f573fa1c71456e6d3f334f80b
---
M includes/htmlform/fields/HTMLDateTimeField.php
M resources/Resources.php
D resources/src/mediawiki/htmlform/datetime.js
3 files changed, 0 insertions(+), 51 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/09/323409/1

diff --git a/includes/htmlform/fields/HTMLDateTimeField.php 
b/includes/htmlform/fields/HTMLDateTimeField.php
index a0eb58f..2637e1e 100644
--- a/includes/htmlform/fields/HTMLDateTimeField.php
+++ b/includes/htmlform/fields/HTMLDateTimeField.php
@@ -52,22 +52,16 @@
                        $min = $this->parseDate( $this->mParams['min'] );
                        if ( $min ) {
                                $ret['min'] = $this->formatDate( $min );
-                               // Because Html::expandAttributes filters it out
-                               $ret['data-min'] = $ret['min'];
                        }
                }
                if ( in_array( 'max', $list ) && isset( $this->mParams['max'] ) 
) {
                        $max = $this->parseDate( $this->mParams['max'] );
                        if ( $max ) {
                                $ret['max'] = $this->formatDate( $max );
-                               // Because Html::expandAttributes filters it out
-                               $ret['data-max'] = $ret['max'];
                        }
                }
 
                $ret['step'] = 1;
-               // Because Html::expandAttributes filters it out
-               $ret['data-step'] = 1;
 
                $ret['type'] = $this->mType;
                $ret['pattern'] = static::$patterns[$this->mType];
diff --git a/resources/Resources.php b/resources/Resources.php
index 587a84d..9c8f75b 100644
--- a/resources/Resources.php
+++ b/resources/Resources.php
@@ -1063,7 +1063,6 @@
                        'resources/src/mediawiki/htmlform/autocomplete.js',
                        'resources/src/mediawiki/htmlform/autoinfuse.js',
                        'resources/src/mediawiki/htmlform/checkmatrix.js',
-                       'resources/src/mediawiki/htmlform/datetime.js',
                        'resources/src/mediawiki/htmlform/cloner.js',
                        'resources/src/mediawiki/htmlform/hide-if.js',
                        'resources/src/mediawiki/htmlform/multiselect.js',
diff --git a/resources/src/mediawiki/htmlform/datetime.js 
b/resources/src/mediawiki/htmlform/datetime.js
deleted file mode 100644
index 2fd2396..0000000
--- a/resources/src/mediawiki/htmlform/datetime.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * HTMLForm enhancements:
- * Add minimal help for date and time fields
- */
-( function ( mw ) {
-
-       mw.hook( 'htmlform.enhance' ).add( function ( $root ) {
-               var supported = {};
-
-               $root
-                       .find( 'input.mw-htmlform-datetime-field' )
-                       .each( function () {
-                               var input,
-                                       type = this.getAttribute( 'type' );
-
-                               if ( type !== 'date' && type !== 'time' && type 
!== 'datetime' ) {
-                                       // WTF?
-                                       return;
-                               }
-
-                               if ( supported[ type ] === undefined ) {
-                                       // Assume that if the browser 
implements validation (so it
-                                       // rejects "bogus" as a value) then it 
supports a proper UI too.
-                                       input = document.createElement( 'input' 
);
-                                       input.setAttribute( 'type', type );
-                                       input.value = 'bogus';
-                                       supported[ type ] = ( input.value !== 
'bogus' );
-                               }
-
-                               if ( supported[ type ] ) {
-                                       if ( !this.getAttribute( 'min' ) ) {
-                                               this.setAttribute( 'min', 
this.getAttribute( 'data-min' ) );
-                                       }
-                                       if ( !this.getAttribute( 'max' ) ) {
-                                               this.setAttribute( 'max', 
this.getAttribute( 'data-max' ) );
-                                       }
-                                       if ( !this.getAttribute( 'step' ) ) {
-                                               this.setAttribute( 'step', 
this.getAttribute( 'data-step' ) );
-                                       }
-                               }
-                       } );
-       } );
-
-}( mediaWiki ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2410c689de3f70f573fa1c71456e6d3f334f80b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
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