blob: 480a7640624d536a1607e05a556677191b9848a2 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<p>This tests selecting content starting in the document into a shadow tree.<br>
To manually test, select "hello world" below by a mouse drag. WebKit should select the phrase.</p>
<div id="container">hello </div>
<script>
const host = document.createElement('div');
container.appendChild(host);
const shadowRoot = host.attachShadow({mode: 'closed'});
shadowRoot.textContent = 'world';
if (window.eventSender) {
eventSender.dragMode = false;
eventSender.mouseMoveTo(container.offsetLeft - 2, container.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseMoveTo(container.offsetLeft + container.offsetWidth - 5, container.offsetTop + container.offsetHeight - 5);
eventSender.mouseUp();
if (getSelection().startContainer.getRootNode() != document)
document.write("The start container's root node was not the document");
if (getSelection().endContainer.getRootNode() != document)
document.write("The end container's root node was not the document");
if (getSelection().getRangeAt(0).startContainer.getRootNode() != document)
document.write("The range's start container's root node was not the document");
if (getSelection().getRangeAt(0).endContainer.getRootNode() != document)
document.write("The range's end container's root node was not the document");
}
</script>
</body>
</html>