blob: a5b0309e69808adbe139a3c15e33ea96af9b73d2 [file] [log] [blame]
<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<iframe id="iframe"></iframe>
<script>
test(function() {
var iframe = document.getElementById('iframe');
iframe.contentDocument.body.innerText = 'foo bar';
iframe.focus();
iframe.contentDocument.execCommand('selectAll');
var selection = window.getSelection();
assert_equals(selection.anchorNode, null, 'anchorNode');
assert_equals(selection.anchorOffset, 0, 'anchorOffset');
assert_equals(selection.focusNode, null, 'focusNode');
assert_equals(selection.focusOffset, 0, 'focusOffset');
var selectionInFrame = iframe.contentDocument.defaultView.getSelection();
var sample = iframe.contentDocument.body.firstChild;
assert_equals(selectionInFrame.anchorNode, sample, 'anchorNode');
assert_equals(selectionInFrame.anchorOffset, 0, 'anchorOffset');
assert_equals(selectionInFrame.focusNode, sample, 'focusNode');
assert_equals(selectionInFrame.focusOffset, 7, 'focusOffset');
}, 'SelectAll command in IFRAME selects only content of IFRAME');
</script>