Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / custom / callback-timing.html
blobf778f5e91560def58deba888e8967ed9627e31c6
1 <script src='../../../resources/js-test.js'></script>
2 <x-foo></x-foo>
3 <script>
4 description('Ensure that custom element callback fires before DOMContentLoaded event');
6 var eventlog = [];
8 addEventListener('DOMContentLoaded', function(e) {
9 eventlog.push('DOMContentLoaded event');
10 });
11 addEventListener('load', function(e) {
12 eventlog.push('load event');
14 shouldBe("eventlog[0]", "'created x-foo'");
15 shouldBe("eventlog[1]", "'DOMContentLoaded event'");
16 shouldBe("eventlog[2]", "'load event'");
17 });
18 var proto = Object.create(HTMLElement.prototype);
19 proto.createdCallback = function() {
20 eventlog.push('created ' + this.localName);
22 document.registerElement('x-foo', {prototype: proto});
23 </script>