Last modified: 2014-02-28 23:03:35 UTC
Currently, the mouse event handling in phantoms is: // mouseenter on the protectednode ve.ce.ProtectedNode.prototype.onProtectedMouseEnter = function () { if ( !this.root.getSurface().dragging ) { this.createPhantoms(); } }; // mousemove on the surface, bound by createPhantoms and unbound by clearPhantoms ve.ce.ProtectedNode.prototype.onSurfaceMouseMove = function ( e ) { var $target = $( e.target ); if ( !$target.hasClass( 've-ce-protectedNode-phantom' ) && $target.closest( '.ve-ce-protectedNode' ).length === 0 ) { this.clearPhantoms(); } }; // mouseout on the surface, bound by createPhantoms and unbound by clearPhantoms ve.ce.ProtectedNode.prototype.onSurfaceMouseOut = function ( e ) { if ( e.toElement === null ) { this.clearPhantoms(); } }; Issues: * the mousemove handler seems to permit moving the mouse directly to a different ProtectedNode without causing the phantoms to be cleared * the mouseout handler uses e.toElement, which is a poorly documented property that's allegedly IE-only * it's generally very difficult to reason about what this code does or convince oneself that it does something reasonable
What's even worse is that if somehow another ProtectedNode does manage to show other phantoms, they will replace the first node's phantoms (because of the way ce.Surface manages phantoms), but if for some reason clearPhantoms() isn't called, the first node will continue to track the now-detached phantoms and reposition them when a transaction occurs.