Use ve.resolveAttributes instead of resolveUrl in clipboard conversion

This method does the tree traversal for us, and resolves src as well
as href.

Change-Id: Ic3ea47fb9acde9a1dad5caac3ee9c9b63c86d900
This commit is contained in:
Ed Sanders 2015-09-15 13:44:52 +01:00
parent e5e1810f02
commit 830718ce22
2 changed files with 4 additions and 10 deletions

View file

@ -104,11 +104,8 @@ ve.dm.MWExtensionNode.static.toDomElements = function ( dataElement, doc, conver
}
}
if ( converter.isForClipboard() ) {
// Resolve image sources
$( els ).find( 'img' ).addBack( 'img' ).each( function () {
var $this = $( this );
$this.attr( 'src', ve.resolveUrl( $this.attr( 'src' ), doc ) );
} );
// Resolve attributes
ve.resolveAttributes( $( els ), doc, ve.dm.Converter.computedAttributes );
}
return els;
};

View file

@ -184,11 +184,8 @@ ve.dm.MWTransclusionNode.static.toDomElements = function ( dataElement, doc, con
els[ i ].setAttribute( 'data-ve-ignore', 'true' );
}
// Resolve image sources
$( els ).find( 'img' ).addBack( 'img' ).each( function () {
var $this = $( this );
$this.attr( 'src', ve.resolveUrl( $this.attr( 'src' ), doc ) );
} );
// Resolve attributes
ve.resolveAttributes( $( els ), doc, ve.dm.Converter.computedAttributes );
}
return els;
};