Catrope has uploaded a new change for review.

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

Change subject: mw.Target: Hopefully fix plugin garbage removal code
......................................................................

mw.Target: Hopefully fix plugin garbage removal code

Follows-up 0547d8c8.

It's still very difficult to test whether this code works, but
doing $( newDoc ).remove( 'selector1' ).remove( 'selector2' )...
demonstrably doesn't work, because 1) the selector passed to remove()
filters the collection, it doesn't descend into it, and 2) remove()
returns the collection of removed items, so chaining it doesn't work.

Instead, use $( newDoc ).find( 'selector1, selector2, ...' ).remove();

Also normalise selectors.

Change-Id: I97f3b28c4d5120f08e5d7fbf4598ddc0c01d4ecf
(cherry picked from commit 70c64e0613c5b2264b0f0d749ec68d3e51ca1883)
---
M modules/ve-mw/init/ve.init.mw.Target.js
1 file changed, 13 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/76/191376/1

diff --git a/modules/ve-mw/init/ve.init.mw.Target.js 
b/modules/ve-mw/init/ve.init.mw.Target.js
index 9a3f9db..715e477 100644
--- a/modules/ve-mw/init/ve.init.mw.Target.js
+++ b/modules/ve-mw/init/ve.init.mw.Target.js
@@ -984,16 +984,19 @@
        copyAttributes( oldDoc.head, newDoc.head );
        copyAttributes( oldDoc.body, newDoc.body );
        $( newDoc )
-               .remove( 'div[id = myEventWatcherDiv]' ) // Bug 51423
-               .remove( 'embed[type = "application/iodbc"]' ) // Bug 51521
-               .remove( 'embed[type = "application/x-datavault"]' ) // Bug 
52791
-               .remove( 'script[id = FoxLingoJs]' ) // Bug 52884
-               .remove( 'style[id = _clearly_component__css]' ) // Bug 53252
-               .remove( 'div[id = sendToInstapaperResults]' ) // Bug 61776
-               .remove( 'embed[id ^= xunlei_com_thunder_helper_plugin]' ) // 
Bug 63121
-               .remove( 'object[type = cosymantecnisbfw], 
script[id=NortonInternetSecurityBF]' ) // Bug 63229
-               .remove( 'div[id = kloutify]' ) // Bug 67006
-               .remove( 'div[id ^= mittoHidden]' ); // Bug 68900#c1
+               .find(
+                       'div[id="myEventWatcherDiv"], ' + // Bug 51423
+                       'embed[type="application/iodbc"], ' + // Bug 51521
+                       'embed[type="application/x-datavault"], ' + // Bug 52791
+                       'script[id="FoxLingoJs"], ' + // Bug 52884
+                       'style[id="_clearly_component__css"], ' + // Bug 53252
+                       'div[id="sendToInstapaperResults"], ' + // Bug 61776
+                       'embed[id^="xunlei_com_thunder_helper_plugin"], ' + // 
Bug 63121
+                       'object[type="cosymantecnisbfw"], 
script[id="NortonInternetSecurityBF"], ' + // Bug 63229
+                       'div[id="kloutify"], ' + // Bug 67006
+                       'div[id^="mittoHidden"]' // Bug 68900#c1
+               )
+               .remove();
        // Add doctype manually
        return '<!doctype html>' + ve.serializeXhtml( newDoc );
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I97f3b28c4d5120f08e5d7fbf4598ddc0c01d4ecf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: wmf/1.25wmf17
Gerrit-Owner: Catrope <[email protected]>

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

Reply via email to