2 <script src=
"../../../resources/js-test.js"></script>
3 <div id=
"test-div">Test
</div>
6 description('Tests that we can create instances of Range using new');
8 shouldBe('typeof new Range', '"object"');
9 shouldBe('Object.prototype.toString.call(new Range)', '"[object Range]"');
10 shouldBeTrue('new Range instanceof Range');
11 shouldBe('Object.getPrototypeOf(new Range)', 'Range.prototype');
14 r
.selectNodeContents(document
.getElementById('test-div'));
15 shouldBe('r.toString()', '"Test"')
17 var frame
= document
.createElement('iframe');
18 document
.body
.appendChild(frame
);
19 var innerWindow
= frame
.contentWindow
;
20 var innerDocument
= frame
.contentDocument
;
21 innerDocument
.body
.textContent
= 'Inner';
23 shouldBeTrue('new innerWindow.Range instanceof innerWindow.Range');
24 shouldBe('Object.getPrototypeOf(new innerWindow.Range)', 'innerWindow.Range.prototype');
26 var r
= new innerWindow
.Range();
27 r
.selectNodeContents(innerDocument
.body
);
28 shouldBe('r.toString()', '"Inner"');