Catrope has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/378821 )
Change subject: CX1: Strip meta tags etc from segmentedContent
......................................................................
CX1: Strip meta tags etc from segmentedContent
Forward compat for I8367f9f2764 in cxserver, which changes
segmentedContent to be an entire HTML document rather than just a body.
There was code removing the <base> tag already, but we also want to
clean up <meta> and <link> tags (which were going through already)
and <title> tags.
Also clean up these tags before appending, rather than after.
Change-Id: Id6235710eaec77f8d9b3eef8abf6c5f838d9b2d4
---
M modules/source/ext.cx.source.js
1 file changed, 4 insertions(+), 5 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation
refs/changes/21/378821/1
diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index 69447ec..1554204 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -186,12 +186,11 @@
}
ContentTranslationSource.prototype.load = function ( content ) {
- var self = this;
+ var self = this,
+ $content = $( $.parseHTML( content.segmentedContent ) );
- this.$content.html( content.segmentedContent );
-
- // TODO: Figure out what should be done here
- this.$content.find( 'base' ).detach();
+ // Filter out meta tags etc and append to the document
+ this.$content.html( $content.not( 'base, meta, link, title' ) );
// Try to load Cite styles. Silently ignored if not installed.
if ( mw.loader.getState( 'ext.cite.style' ) !== null ) {
--
To view, visit https://gerrit.wikimedia.org/r/378821
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id6235710eaec77f8d9b3eef8abf6c5f838d9b2d4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits