diff --git a/modules/ve-mw/ce/annotations/ve.ce.MWExternalLinkAnnotation.js b/modules/ve-mw/ce/annotations/ve.ce.MWExternalLinkAnnotation.js index fae1848ccf..041113a61f 100644 --- a/modules/ve-mw/ce/annotations/ve.ce.MWExternalLinkAnnotation.js +++ b/modules/ve-mw/ce/annotations/ve.ce.MWExternalLinkAnnotation.js @@ -20,7 +20,9 @@ ve.ce.MWExternalLinkAnnotation = function VeCeMWExternalLinkAnnotation( model ) ve.ce.MWExternalLinkAnnotation.super.apply( this, arguments ); // DOM changes - if ( model.getAttribute( 'rel' ) === 'mw:WikiLink/Interwiki' ) { + var rel = model.getAttribute( 'rel' ) || ''; + var relValues = rel.split( /\s+/ ); + if ( relValues.indexOf( 'mw:WikiLink/Interwiki' ) >= 0 ) { this.$anchor.addClass( 'extiw' ); } else { this.$anchor.addClass( 'external' ); diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js index dac108c5d2..52408847e3 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js @@ -210,7 +210,7 @@ ve.ce.MWTransclusionNode.prototype.getRenderedDomElements = function () { */ ve.ce.MWTransclusionNode.prototype.filterRenderedDomElements = function ( domElements ) { // We want to remove all styles and links which aren't from TemplateStyles. - var selector = 'style:not([data-mw-deduplicate^="TemplateStyles:"]), link:not([rel="mw-deduplicated-inline-style"][href^="mw-data:TemplateStyles:"])'; + var selector = 'style:not([data-mw-deduplicate^="TemplateStyles:"]), link:not([rel~="mw-deduplicated-inline-style"][href^="mw-data:TemplateStyles:"])'; return $( domElements ).find( selector ).addBack( selector ).remove().end().end().toArray(); }; diff --git a/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js b/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js index 553673be3f..2a6228e588 100644 --- a/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js +++ b/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js @@ -75,6 +75,7 @@ ve.dm.MWExternalLinkAnnotation.static.toDomElements = function ( dataElement, do domElements[ 0 ].setAttribute( 'class', 'external' ); } + // we just created that link so the 'rel' attribute should be safe domElements[ 0 ].setAttribute( 'rel', dataElement.attributes.rel || 'mw:ExtLink' ); return domElements; }; diff --git a/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js b/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js index c4c6a1401a..3570d97017 100644 --- a/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js +++ b/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js @@ -108,6 +108,7 @@ ve.dm.MWInternalLinkAnnotation.static.newFromTitle = function ( title, rawTitle ve.dm.MWInternalLinkAnnotation.static.toDomElements = function () { var parentResult = ve.dm.LinkAnnotation.static.toDomElements.apply( this, arguments ); + // we just created that link so the 'rel' attribute should be safe parentResult[ 0 ].setAttribute( 'rel', 'mw:WikiLink' ); return parentResult; }; diff --git a/modules/ve-mw/preinit/ve.utils.parsoid.js b/modules/ve-mw/preinit/ve.utils.parsoid.js index 22e37b7d13..9042884d12 100644 --- a/modules/ve-mw/preinit/ve.utils.parsoid.js +++ b/modules/ve-mw/preinit/ve.utils.parsoid.js @@ -100,7 +100,7 @@ mw.libs.ve.stripRestbaseIds = function ( doc ) { * @param {HTMLElement} element Parent element, e.g. document body */ mw.libs.ve.reduplicateStyles = function ( element ) { - Array.prototype.forEach.call( element.querySelectorAll( 'link[rel="mw-deduplicated-inline-style"]' ), function ( link ) { + Array.prototype.forEach.call( element.querySelectorAll( 'link[rel~="mw-deduplicated-inline-style"]' ), function ( link ) { var href = link.getAttribute( 'href' ); if ( !href || href.slice( 0, 'mw-data:'.length ) !== 'mw-data:' ) { return;