jenkins-bot has submitted this change and it was merged.
Change subject: Fix freaky disappearance of template nodes
......................................................................
Fix freaky disappearance of template nodes
ce.GeneratedContentNode had an interesting bug where it called .append()
directly on DOM elements stored in the store. They weren't cloned,
which meant the previous rendering of the same node would just disappear,
and they also weren't adopted into the correct document which would
probably have caused other issues as well.
Properly clone and transplant the nodes from the store before attaching
them to the DOM.
Change-Id: I423db85cb7c3851a9bf68de03c72aa22994d9474
---
M modules/ve/ce/nodes/ve.ce.GeneratedContentNode.js
1 file changed, 7 insertions(+), 2 deletions(-)
Approvals:
Trevor Parscal: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve/ce/nodes/ve.ce.GeneratedContentNode.js
b/modules/ve/ce/nodes/ve.ce.GeneratedContentNode.js
index 4253fcb..68702c5 100644
--- a/modules/ve/ce/nodes/ve.ce.GeneratedContentNode.js
+++ b/modules/ve/ce/nodes/ve.ce.GeneratedContentNode.js
@@ -33,13 +33,18 @@
* @method
*/
ve.ce.GeneratedContentNode.prototype.onUpdate = function () {
- var store = this.model.doc.getStore(),
+ var doc = this.getElementDocument(),
+ store = this.model.doc.getStore(),
index = store.indexOfHash( ve.getHash( this.model ) );
if ( index !== null ) {
if ( this.live ) {
this.emit( 'teardown' );
}
- this.$.empty().append( store.value( index ) );
+ this.$.empty().append(
+ this.$$( store.value( index ) ).map( function ( i,
domElement ) {
+ return doc.importNode( domElement, true );
+ } )
+ );
if ( this.live ) {
this.emit( 'setup' );
}
--
To view, visit https://gerrit.wikimedia.org/r/67211
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I423db85cb7c3851a9bf68de03c72aa22994d9474
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits