diff options
Diffstat (limited to 'www/wiki/resources/src/mediawiki/htmlform/htmlform.js')
-rw-r--r-- | www/wiki/resources/src/mediawiki/htmlform/htmlform.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/www/wiki/resources/src/mediawiki/htmlform/htmlform.js b/www/wiki/resources/src/mediawiki/htmlform/htmlform.js new file mode 100644 index 00000000..bc835b59 --- /dev/null +++ b/www/wiki/resources/src/mediawiki/htmlform/htmlform.js @@ -0,0 +1,14 @@ +( function ( mw, $ ) { + + $( function () { + mw.hook( 'htmlform.enhance' ).fire( $( document ) ); + } ); + + mw.hook( 'htmlform.enhance' ).add( function ( $root ) { + // Turn HTML5 form validation back on, in cases where it was disabled server-side (see + // HTMLForm::needsJSForHtml5FormValidation()) because we need extra logic implemented in JS to + // validate correctly. Currently, this is only used for forms containing fields with 'hide-if'. + $root.find( '.mw-htmlform' ).removeAttr( 'novalidate' ); + } ); + +}( mediaWiki, jQuery ) ); |