summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching-text-node-in-shadow-root.html
blob: 3a0b21a103b56dfee40a9828b3f22023fe797861 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<head>
    <script src="../../../resources/js-test.js"></script>
    <script src="resources/shadow-dom.js"></script>
    <script src="resources/event-dispatching.js"></script>
</head>
<body>
    <p id="description"></p>
    <div id="sandbox"></div>
    <pre id="console"></pre>
    <script>
        var sandbox = document.getElementById('sandbox');

        sandbox.appendChild(
            createDOM('div', {'id': 'top'},
                      createDOM('div', {'id': 'shadow-host'},
                                createShadowRoot({'id': 'shadow-root'}))));
        var shadowRoot = getNodeInComposedTree('shadow-host/');
        shadowRoot.innerHTML = 'Text Nodes';
        addEventListeners(['top', 'shadow-host', 'shadow-host/']);
        showSandboxTree();

        // Calculates the position of the text node in the shadow root.
        var host = document.getElementById('shadow-host');
        var x = host.offsetLeft + 5;
        var y = host.offsetTop + defaultPaddingSize + 5;
        debug('\n' + 'Moving mouse from a direct child text node of the shadow root to top');
        eventSender.mouseMoveTo(x, y);
        clearEventRecords();

        moveMouseOver(document.getElementById('top'));
        debugDispatchedEvent('mouseout');
        debugDispatchedEvent('mouseover');

        touchLocation(host);
        debugDispatchedEvent('touchstart');

        scrollMouseWheel(host);
        debugDispatchedEvent('mousewheel');
    </script>
</body>
</html>