diff --git a/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js b/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js index c54cfd2c05..5c91bd936f 100644 --- a/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js +++ b/modules/ve-mw/dm/annotations/ve.dm.MWExternalLinkAnnotation.js @@ -35,10 +35,14 @@ ve.dm.MWExternalLinkAnnotation.static.name = 'link/mwExternal'; ve.dm.MWExternalLinkAnnotation.static.matchFunction = function ( domElement ) { var type = domElement.getAttribute( 'rel' ) || domElement.getAttribute( 'typeof' ) || domElement.getAttribute( 'property' ); - // Match explicity mw:ExtLink (external links), mw:WikiLink/Interwiki + // Match explicitly mw:ExtLink (external links), mw:WikiLink/Interwiki // (interwiki links), or plain RDFa-less links with an href // (e.g. from external paste) - return ( !type && domElement.hasAttribute( 'href' ) ) || type === 'mw:ExtLink' || type === 'mw:WikiLink/Interwiki'; + if ( type ) { + type = type.split( ' ' ); + return type.indexOf( 'mw:ExtLink' ) !== -1 || type.indexOf( 'mw:WikiLink/Interwiki' ) !== -1; + } + return domElement.hasAttribute( 'href' ); }; ve.dm.MWExternalLinkAnnotation.static.toDataElement = function ( domElements, converter ) { diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js index 819c13ae10..1b3ef664e2 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js @@ -195,7 +195,7 @@ ve.ui.MWSaveDialog.prototype.showPreview = function ( docOrMsg, baseDoc ) { if ( docOrMsg instanceof HTMLDocument ) { // Extract required modules for stylesheet tags (avoids re-loading styles) - Array.prototype.forEach.call( docOrMsg.head.querySelectorAll( 'link[rel=stylesheet]' ), function ( link ) { + Array.prototype.forEach.call( docOrMsg.head.querySelectorAll( 'link[rel~=stylesheet]' ), function ( link ) { var uri = new mw.Uri( link.href ); if ( uri.query.modules ) { modules = modules.concat( ve.expandModuleNames( uri.query.modules ) ); @@ -208,7 +208,7 @@ ve.ui.MWSaveDialog.prototype.showPreview = function ( docOrMsg, baseDoc ) { mw.loader.using( modules ); body = docOrMsg.body; // Take a snapshot of all categories - Array.prototype.forEach.call( body.querySelectorAll( 'link[rel="mw:PageProp/Category"]' ), function ( element ) { + Array.prototype.forEach.call( body.querySelectorAll( 'link[rel~="mw:PageProp/Category"]' ), function ( element ) { categories.push( ve.dm.MWCategoryMetaItem.static.toDataElement( [ element ] ).attributes.category ); } ); // Import body to current document, then resolve attributes against original document (parseDocument called #fixBase)