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
This commit is contained in:
Catrope 2013-05-26 12:23:55 +02:00
parent 6ddf7f3695
commit e6c7aa4275

View file

@ -105,6 +105,9 @@ ve.ce.ProtectedNode.prototype.onProtectedTeardown = function () {
// Shields
this.$shields.remove();
this.$shields = $( [] );
// Phantoms
this.clearPhantoms();
};
/**