OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <!-- This file is intentionally malformed. --> | |
3 <html xmlns="http://www.w3.org/1999/xhtml"> | |
4 <script> | |
5 <![CDATA[ | |
6 var done = false; | |
7 var range = null; | |
8 var f = function () | |
9 { | |
10 range = document.createRange(); | |
11 range.expand("sentence"); | |
12 range.deleteContents(); | |
13 }; | |
14 var repeat = 0; | |
15 var g = function () | |
16 { | |
17 if (done) | |
18 return; | |
19 ++repeat; | |
20 if (repeat >= 2) { | |
21 done = true; | |
22 document.removeEventListener("DOMSubtreeModified", listener, true); | |
23 window.parent.postMessage("done", "*"); | |
24 return; | |
25 } | |
26 range.detach(); | |
27 }; | |
28 | |
29 var firstCall = true; | |
30 function listener() | |
31 { | |
32 if (firstCall) { | |
33 firstCall = false; | |
34 f(); | |
35 } else | |
36 g(); | |
37 } | |
38 document.addEventListener("DOMSubtreeModified", listener, true); | |
39 | |
40 document.addEventListener("DOMContentLoaded", f); | |
41 ]]> | |
42 </script> | |
OLD | NEW |