blob: 2126935e8ca2e30490daa0b14c77050d0d56b899 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../fast/dom/resources/event-sender-util.js"></script>
<script src="../../resources/js-test.js"></script>
<p>When selecting from a child of shadow host to an element in Shadow DOM, a crash should not be caused.
This is because the start position of Selection comes after the end position of Selection.</p>
<div contenteditable>
before host <span id="host" contenteditable="false">drag from here<span id="target"> </span> after host</span>
</div>
<pre id="console"></pre>
<script>
var shadowRoot = host.createShadowRoot();
shadowRoot.innerHTML = "<span id='shadow-host'>before shadow<shadow id='shadow'><content></content></shadow>after shadow</span>"
var nestedShadowHost = shadowRoot.getElementById('shadow-host');
var nestedShadowRoot = nestedShadowHost.createShadowRoot();
nestedShadowRoot.innerHTML = "<span contenteditable>before nested<shadow><content></content></shadow>after nested</span>"
// This should not cause a crash.
eventSender.mouseMoveTo(target.offsetLeft - 10, target.offsetTop + target.offsetHeight / 2);
eventSender.mouseDown();
eventSender.mouseMoveTo(nestedShadowHost.offsetLeft + 10, nestedShadowHost.offsetTop + nestedShadowHost.offsetHeight / 2);
eventSender.mouseUp();
debug('PASS');
var successfullyParsed = true;
</script>
</body>
</html>