From e6c7aa42752a7600370ae96d9f52a51f56dd95a8 Mon Sep 17 00:00:00 2001 From: Catrope Date: Sun, 26 May 2013 12:23:55 +0200 Subject: [PATCH] Clear phantoms on teardown in ProtectedNode When you typed after a ProtectedNode that was previously at the end of a paragraph, then moved the mouse, you'd get a JS error. What happened was the typing caused a new TextNode to be created after the ProtectedNode, which caused the ParagraphNode to be rebuilt, detaching the original ProtectedNode and creating a new one. The detached ProtectedNode was still bound to mousemove on the body, and when that event fired it would try to remove its phantoms from the surface and fail because detached nodes can't get to the surface. Change-Id: I9f38776f0267645b14d7b26e2a25007cf3be8ec7 --- modules/ve/ce/ve.ce.ProtectedNode.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/ve/ce/ve.ce.ProtectedNode.js b/modules/ve/ce/ve.ce.ProtectedNode.js index e0ec632a21..081f22e6f8 100644 --- a/modules/ve/ce/ve.ce.ProtectedNode.js +++ b/modules/ve/ce/ve.ce.ProtectedNode.js @@ -105,6 +105,9 @@ ve.ce.ProtectedNode.prototype.onProtectedTeardown = function () { // Shields this.$shields.remove(); this.$shields = $( [] ); + + // Phantoms + this.clearPhantoms(); }; /**