forked from jackcviers/Rangy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bug.html
31 lines (30 loc) · 1.09 KB
/
bug.html
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
29
30
31
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>WebKit/Opera Range bug</title>
<script type="text/javascript">
window.onload = function() {
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
var doc = iframe.contentDocument;
doc.write("<html><head><body>stuff</body></html>");
doc.close();
var r = document.createRange();
r.selectNodeContents(document.getElementById("test"));
// Move range start to the iframe document. According to the DOM
// Range spec, this should collapse the Range to the new boundary
// but in WebKit we get a WRONG_DOCUMENT_ERR
try {
r.setStart(doc.body, 0);
alert(r.startContainer.firstChild.data); // Should be "stuff"
} catch (ex) {
alert("Error: " + ex);
}
};
</script>
</head>
<body>
<div id="test">Some content</div>
</body>
</html>