jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/404515 )

Change subject: summary: skip removing data-mw attributes
......................................................................


summary: skip removing data-mw attributes

Skip removing data-mw attributes in the summary endpoint since we later
remove all attributes which are not white-listed anyways.

Change-Id: Idc7b4a4e9f269ea49c2e4ec7a27ea0d0daf34f7a
---
M lib/transformations/summarize.js
1 file changed, 2 insertions(+), 4 deletions(-)

Approvals:
  jenkins-bot: Verified
  Mholloway: Looks good to me, approved



diff --git a/lib/transformations/summarize.js b/lib/transformations/summarize.js
index 2b70ece..6c55b25 100644
--- a/lib/transformations/summarize.js
+++ b/lib/transformations/summarize.js
@@ -3,7 +3,6 @@
 const domino = require('domino');
 const flattenElements = require('./flattenElements');
 const rmElementsWithSelector = require('./rmElementsWithSelector');
-const removeAttributes = require('./removeAttributes');
 const NodeType = require('../nodeType');
 
 const DISALLOWED_ELEMENTS = ['OBJECT', 'SCRIPT', 'STYLE'];
@@ -79,7 +78,7 @@
  * Removes unwanted nodes and element attributes.
  * @param {!Document} document the DOM document
  */
-function removeUnwantedNodes(document) {
+function removeUnwantedNodesAndAttributes(document) {
     traverseDF(document.body);
 }
 
@@ -108,13 +107,12 @@
 module.exports = function(html) {
     const doc = domino.createDocument(html);
     flattenElements(doc, 'a');
-    removeAttributes(doc, '*', ['data-mw']);
     rmElementsWithSelector(doc, '.mw-ref, .reference');
     rmElementsWithSelector(doc, '.noexcerpt');
     rmElementsWithSelector(doc, '.noprint');
     rmElementsWithSelector(doc, 'math');
     rmElementsWithSelector(doc, 'span:empty,b:empty,i:empty,p:empty');
-    removeUnwantedNodes(doc);
+    removeUnwantedNodesAndAttributes(doc);
 
     html = doc.body.innerHTML;
     html = removeNestedParentheticals(html);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idc7b4a4e9f269ea49c2e4ec7a27ea0d0daf34f7a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/mobileapps
Gerrit-Branch: master
Gerrit-Owner: BearND <[email protected]>
Gerrit-Reviewer: Fjalapeno <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: Mhurd <[email protected]>
Gerrit-Reviewer: Ppchelko <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to