summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/document-set-title-mutations.html
blob: c8f1be28ee6efe2f235ab0f6d63d86fb8d5320ff (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
<!doctype html>
<title>old</title>
<script src="../../resources/js-test.js"></script>
<script>
    window.jsTestIsAsync = true;
    description("Test for mutations to childList when setting document.title.");
    var mutations;
    function finish() {
        shouldBe('mutations.length', '1');
        shouldBe('mutations[0].type', '"childList"');
        shouldBe('mutations[0].addedNodes.length', '1');
        shouldBe('mutations[0].removedNodes.length', '1');
        finishJSTest();
    }

    var titleElement = document.querySelector('title');
    var i = 0;

    var observer = new MutationObserver(function(mutations) {
        window.mutations = mutations;
    });
    observer.observe(titleElement, { childList: true });
    document.title = "new";

    setTimeout(finish, 0);
</script>
<body>
</body>