Mattflaschen has uploaded a new change for review.

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

Change subject: Update to follow jQuery 1.11 upgrade guide
......................................................................

Update to follow jQuery 1.11 upgrade guide

* Call $.parseHTML explicitly when there's a possibility the string
  might not start with a <.
* Use .prop instead of .attr, for disabled.
* Documentation fixes

Bug: T85511
Bug: T85508
Change-Id: I502c21c4e8d23a97b2967139cf336271a2a97c39
---
M modules/engine/components/board/base/flow-board-api-events.js
M modules/engine/misc/flow-handlebars.js
M modules/engine/misc/mw-ui.enhance.js
3 files changed, 16 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/99/187799/1

diff --git a/modules/engine/components/board/base/flow-board-api-events.js 
b/modules/engine/components/board/base/flow-board-api-events.js
index 528ef82..9affbb8 100644
--- a/modules/engine/components/board/base/flow-board-api-events.js
+++ b/modules/engine/components/board/base/flow-board-api-events.js
@@ -990,10 +990,10 @@
                        var $replacement,
                                flowBoard = mw.flow.getPrototypeMethod( 
'board', 'getInstanceByElement' )( $( this ) );
                        if ( revision.isModerated && 
!flowBoard.constructor.static.inTopicNamespace( $target ) ) {
-                               $replacement = $( 
mw.flow.TemplateEngine.processTemplate(
+                               $replacement = $( $.parseHTML( 
mw.flow.TemplateEngine.processTemplate(
                                        'flow_moderate_topic_confirmation',
                                        revision
-                               ) );
+                               ) ) );
 
                                $target.closest( '.flow-topic' ).replaceWith( 
$replacement );
                                flowBoard.emitWithReturn( 
'makeContentInteractive', $replacement );
@@ -1013,10 +1013,10 @@
                                flowBoard = mw.flow.getPrototypeMethod( 
'board', 'getInstanceByElement' )( $( this ) );
 
                        if ( revision.isModerated ) {
-                               $replacement = $( 
flowBoard.constructor.static.TemplateEngine.processTemplate(
+                               $replacement = $( $.parseHTML( 
flowBoard.constructor.static.TemplateEngine.processTemplate(
                                        'flow_moderate_post_confirmation',
                                        revision
-                               ) );
+                               ) ) );
                                $target.closest( '.flow-post-main' 
).replaceWith( $replacement );
                                flowBoard.emitWithReturn( 
'makeContentInteractive', $replacement );
                        } else {
diff --git a/modules/engine/misc/flow-handlebars.js 
b/modules/engine/misc/flow-handlebars.js
index eb7d7aa..819f6d8 100644
--- a/modules/engine/misc/flow-handlebars.js
+++ b/modules/engine/misc/flow-handlebars.js
@@ -548,7 +548,7 @@
        FlowHandlebars.prototype.plaintextSnippet = function ( contentFormat, 
content ) {
                var retval;
                if ( contentFormat === 'html' ) {
-                       retval = $( content ).text();
+                       retval = $( $.parseHTML( content ) ).text();
                } else {
                        // @todo handle wikitext -> plaintext?
                        retval = content;
diff --git a/modules/engine/misc/mw-ui.enhance.js 
b/modules/engine/misc/mw-ui.enhance.js
index bca0db9..0772a12 100644
--- a/modules/engine/misc/mw-ui.enhance.js
+++ b/modules/engine/misc/mw-ui.enhance.js
@@ -103,7 +103,7 @@
 
                // @todo scrap data-role? use submit types? or a single 
role=action?
                $form.find( '.mw-ui-button' ).filter( '[data-role=action], 
[data-role=submit]' )
-                       .attr( 'disabled', !ready );
+                       .prop( 'disabled', !ready );
        }
        /*
         * Disable / enable preview and submit buttons without/with text in 
field.
@@ -140,8 +140,9 @@
                 *  tooltipClosable=Boolean
                 *  tooltipContentCallback=Function
                 *
-                * @param {Element} target
-                * @param {Element|String} [content]
+                * @param {jQuery|Element} target
+                * @param {jQuery|Element|String} [content] A jQuery set, an 
element, or a string of
+                *  HTML.  If omitted, first tries tooltipContentCallback, then 
target.title
                 * @param {Object} [options]
                 */
                function mwUiTooltipShow( target, content, options ) {
@@ -208,7 +209,11 @@
                        if ( !$tooltip ) {
                                // See if content itself is a tooltip
                                try {
-                                       $tooltip = $( content );
+                                       if ( $.type( content ) === 'string' ) {
+                                               $tooltip = $( $.parseHTML( 
content ) );
+                                       } else {
+                                               $tooltip = $( content );
+                                       }
                                } catch ( e ) {}
                                if ( !$tooltip || !$tooltip.is( 
'.flow-ui-tooltip' ) && !$tooltip.find( '.flow-ui-tooltip' ).length ) {
                                        // Content is not and does not contain 
a tooltip, so instead, put content inside a new tooltip wrapper
@@ -392,7 +397,7 @@
                };
 
                /**
-                * Event handler for mouse entering on a .mw-ui-tooltip-target
+                * Event handler for mouse entering on a .flow-ui-tooltip-target
                 * @param {Event} event
                 */
                function onMwUiTooltipFocus( event ) {
@@ -400,7 +405,7 @@
                }
 
                /**
-                * Event handler for mouse leaving a .mw-ui-tooltip-target
+                * Event handler for mouse leaving a .flow-ui-tooltip-target
                 * @param {Event} event
                 */
                function onMwUiTooltipBlur( event ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I502c21c4e8d23a97b2967139cf336271a2a97c39
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>

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

Reply via email to