summaryrefslogtreecommitdiffstats
path: root/layout/reftests/selection/addrange-2.html
blob: 480e9367800ef8ad431ed3526f5db7b64a58eeb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<html>
    <head>
        <title>Testcase #3 for bug 602331</title>
        <script type="text/javascript" charset="utf-8">
            function selectAllOfNewNodes() {
                window.getSelection().removeAllRanges();
                
                var newNode = document.createElement('span');
                newNode.innerHTML = "Kitty";
                document.getElementById('new_nodes').appendChild(newNode);
                var range = document.createRange();
                range.selectNode(document.getElementById('new_nodes'));
                window.getSelection().addRange(range);
                
            }
            
        </script>
    </head>
    <body onload="selectAllOfNewNodes()">
        * <span id="new_nodes"><span>Hello</span> </span> *
    </body>
</html>