2 <p id=
"description"></p>
3 <div id=
"sample"><span contenteditable=
"true">foobar
</span></div>
5 <div id=
"console"></div>
6 <script src=
"../../../resources/js-test.js"></script>
8 description('Range objects should be updated after set innerHTML.');
10 function $(id
) { return document
.getElementById(id
); }
13 function eventHandler(event
) {
14 if (ranges
[event
.type
])
16 ranges
[event
.type
] = document
.createRange();
17 ranges
[event
.type
].selectNodeContents(sample
.firstChild
.firstChild
);
20 document
.addEventListener('blur', eventHandler
, true);
21 document
.addEventListener('DOMNodeRemovedFromDocument', eventHandler
, true);
23 $('sample').firstChild
.focus();
24 $('sample').innerHTML
= '';
26 shouldBe('ranges["blur"].startOffset', '0');
27 shouldBe('ranges["blur"].endOffset', '0');
28 shouldBe('ranges["DOMNodeRemovedFromDocument"].startOffset', '0');
29 shouldBe('ranges["DOMNodeRemovedFromDocument"].endOffset', '0');
31 if (window
.testRunner
)
32 $('container').outerHTML
= '';