mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Fix copyDomElement issues
* Fix bug in MWTransclusionNode sometimes passing a NodeList rather than an array (caused an error because NodeLists can't be .map()ped) * Use copyDomElements in ce.AlienNode as well Change-Id: I11c6483d3c062047be80f75a3fac03f13bff9662
This commit is contained in:
parent
60da007ab9
commit
dfbd870e16
|
@ -54,7 +54,8 @@ ve.ce.AlienNode.static.$phantomTemplate = ve.ce.AlienNode.static.$phantomTemplat
|
|||
* @method
|
||||
*/
|
||||
ve.ce.AlienNode.prototype.onUpdate = function () {
|
||||
this.$.html( ve.copyArray( this.model.getAttribute( 'domElements' ) || [] ) );
|
||||
// TODO use GeneratedContentNode the way it was meant to be used
|
||||
this.$.html( ve.copyDomElements( this.model.getAttribute( 'domElements' ) || [], this.getElementDocument() ) );
|
||||
};
|
||||
|
||||
/* Concrete subclasses */
|
||||
|
|
|
@ -85,7 +85,7 @@ ve.ce.MWTransclusionNode.prototype.onParseSuccess = function ( deferred, respons
|
|||
// We have to do this because the PHP parser wraps everything in <p>s, and inline templates
|
||||
// will render strangely when wrapped in <p>s.
|
||||
if ( contentNodes.length === 1 && contentNodes[0].nodeName.toLowerCase() === 'p' ) {
|
||||
contentNodes = contentNodes[0].childNodes;
|
||||
contentNodes = Array.prototype.slice.apply( contentNodes[0].childNodes );
|
||||
}
|
||||
deferred.resolve( contentNodes );
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue