blob: ac67a70f18402337f698210895b22e1be5ad8559 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/js-test-pre.js"></script>
<div id="test-div">Test</div>
<script>
description('Tests that we can create instances of Range using new');
shouldBe('typeof new Range', '"object"');
shouldBe('Object.prototype.toString.call(new Range)', '"[object Range]"');
shouldBeTrue('new Range instanceof Range');
shouldBe('Object.getPrototypeOf(new Range)', 'Range.prototype');
var r = new Range();
r.selectNodeContents(document.getElementById('test-div'));
shouldBe('r.toString()', '"Test"')
var frame = document.createElement('iframe');
document.body.appendChild(frame);
var innerWindow = frame.contentWindow;
var innerDocument = frame.contentDocument;
innerDocument.body.textContent = 'Inner';
shouldBeTrue('new innerWindow.Range instanceof innerWindow.Range');
shouldBe('Object.getPrototypeOf(new innerWindow.Range)', 'innerWindow.Range.prototype');
var r = new innerWindow.Range();
r.selectNodeContents(innerDocument.body);
shouldBe('r.toString()', '"Inner"');
</script>
<script src="../../../resources/js-test-post.js"></script>