mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-23 22:13:34 +00:00
Merge "Make RDF attribute splits more robust"
This commit is contained in:
commit
3f1626c4f9
|
@ -39,7 +39,7 @@ ve.dm.MWExternalLinkAnnotation.static.toDataElement = function ( domElements, co
|
|||
var dataElement, annotation,
|
||||
domElement = domElements[ 0 ],
|
||||
type = domElement.getAttribute( 'rel' ) || domElement.getAttribute( 'typeof' ) || domElement.getAttribute( 'property' ) || '',
|
||||
types = type.split( ' ' );
|
||||
types = type.trim().split( /\s+/ );
|
||||
|
||||
// If the link doesn't have a known RDFa type, auto-convert it to the correct type (internal/external/span)
|
||||
if ( types.indexOf( 'mw:ExtLink' ) === -1 && types.indexOf( 'mw:WikiLink/Interwiki' ) === -1 ) {
|
||||
|
|
|
@ -76,7 +76,7 @@ ve.dm.MWBlockImageNode.static.toDataElement = function ( domElements, converter
|
|||
img = imgWrapper.children[ 0 ]; // <img>, <video> or <audio>
|
||||
captionNode = figure.children[ 1 ]; // <figcaption> or undefined
|
||||
classAttr = figure.getAttribute( 'class' );
|
||||
typeofAttrs = figure.getAttribute( 'typeof' ).split( ' ' );
|
||||
typeofAttrs = figure.getAttribute( 'typeof' ).trim().split( /\s+/ );
|
||||
mwDataJSON = figure.getAttribute( 'data-mw' );
|
||||
mwData = mwDataJSON ? JSON.parse( mwDataJSON ) : {};
|
||||
errorIndex = typeofAttrs.indexOf( 'mw:Error' );
|
||||
|
|
|
@ -29,7 +29,7 @@ ve.dm.MWGalleryCaptionNode.static.matchTagNames = [ 'li' ];
|
|||
ve.dm.MWGalleryCaptionNode.static.matchFunction = function ( element ) {
|
||||
var parentTypeof = ( element.parentNode && element.parentNode.getAttribute( 'typeof' ) ) || '';
|
||||
return element.getAttribute( 'class' ) === 'gallerycaption' &&
|
||||
parentTypeof.split( ' ' ).indexOf( 'mw:Extension/gallery' ) !== -1;
|
||||
parentTypeof.trim().split( /\s+/ ).indexOf( 'mw:Extension/gallery' ) !== -1;
|
||||
};
|
||||
|
||||
ve.dm.MWGalleryCaptionNode.static.parentNodeTypes = [ 'mwGallery' ];
|
||||
|
|
|
@ -35,7 +35,7 @@ ve.dm.MWGalleryImageNode.static.childNodeTypes = [ 'mwGalleryImageCaption' ];
|
|||
ve.dm.MWGalleryImageNode.static.matchFunction = function ( element ) {
|
||||
var parentTypeof = ( element.parentNode && element.parentNode.getAttribute( 'typeof' ) ) || '';
|
||||
return element.getAttribute( 'class' ) === 'gallerybox' &&
|
||||
parentTypeof.split( ' ' ).indexOf( 'mw:Extension/gallery' ) !== -1;
|
||||
parentTypeof.trim().split( /\s+/ ).indexOf( 'mw:Extension/gallery' ) !== -1;
|
||||
};
|
||||
|
||||
ve.dm.MWGalleryImageNode.static.parentNodeTypes = [ 'mwGallery' ];
|
||||
|
|
|
@ -55,7 +55,7 @@ ve.dm.MWInlineImageNode.static.toDataElement = function ( domElements, converter
|
|||
figureInline = domElements[ 0 ],
|
||||
imgWrapper = figureInline.children[ 0 ], // <a> or <span>
|
||||
img = imgWrapper.children[ 0 ], // <img>, <video> or <audio>
|
||||
typeofAttrs = ( figureInline.getAttribute( 'typeof' ) || '' ).split( ' ' ),
|
||||
typeofAttrs = ( figureInline.getAttribute( 'typeof' ) || '' ).trim().split( /\s+/ ),
|
||||
mwDataJSON = figureInline.getAttribute( 'data-mw' ),
|
||||
mwData = mwDataJSON ? JSON.parse( mwDataJSON ) : {},
|
||||
classes = figureInline.getAttribute( 'class' ),
|
||||
|
|
Loading…
Reference in a new issue