blob: 751c62e80cfec76c7b1a60572405b567e134354b [file] [log] [blame]
<!doctype html>
<script src="../../resources/js-test-pre.js"></script>
<iframe data-test="frameborder=1 is true" data-assert-frame-width="145">
<!doctype html>
<!--
To test true values we need to nest in a false value first since the
default value is already true. If we didn't do this then the tests would
pass even if the browser ignored the attribute entirely.
-->
<frameset rows="*" cols="*" frameborder="0">
<frameset rows="*" cols="50,50" frameborder="1" border="10">
<frame src="data:text/html,<body bgcolor=red>">
<frame src="data:text/html,<body bgcolor=blue>">
</frameset>
</frameset>
</iframe>
<iframe data-test="frameborder=yes is true" data-assert-frame-width="145">
<!doctype html>
<frameset rows="*" cols="*" frameborder="0">
<frameset rows="*" cols="50,50" frameborder="yes" border="10">
<frame src="data:text/html,<body bgcolor=red>">
<frame src="data:text/html,<body bgcolor=blue>">
</frameset>
</frameset>
</iframe>
<iframe data-test="frameborder=0 is false" data-assert-frame-width="150">
<!doctype html>
<frameset rows="*" cols="50,50" frameborder="0">
<frame src="data:text/html,<body bgcolor=red>">
<frame src="data:text/html,<body bgcolor=blue>">
</frameset>
</iframe>
<iframe data-test="frameborder=no is false" data-assert-frame-width="150">
<!doctype html>
<frameset rows="*" cols="50,50" frameborder="nO">
<frame src="data:text/html,<body bgcolor=red>">
<frame src="data:text/html,<body bgcolor=blue>">
</frameset>
</iframe>
<iframe data-test="Invalid values like frameborder=false are ignored" data-assert-frame-width="147">
<!doctype html>
<frameset rows="*" cols="50,50" frameborder="false">
<frame src="data:text/html,<body bgcolor=red>">
<frame src="data:text/html,<body bgcolor=blue>">
</frameset>
</iframe>
<iframe data-test="Invalid values like frameborder=2 are ignored" data-assert-frame-width="147">
<!doctype html>
<frameset rows="*" cols="50,50" frameborder="2">
<frame src="data:text/html,<body bgcolor=red>">
<frame src="data:text/html,<body bgcolor=blue>">
</frameset>
</iframe>
<script>
description('Check frameset frameborder attribute allows 1,yes for true and 0,no for false');
iframes = [].slice.call(document.querySelectorAll('iframe'));
iframes.forEach(function(iframe) {
// Can't use srcdoc since that wouldn't synchronously load the content.
iframe.contentDocument.write(iframe.textContent);
iframe.contentDocument.close();
frameset = iframe.contentDocument.querySelector('frameset');
expectedWidth = iframe.dataset.assertFrameWidth;
frames = frameset.querySelectorAll('frame');
debug(iframe.dataset.test);
shouldBe('frames[0].offsetWidth', expectedWidth);
shouldBe('frames[1].offsetWidth', expectedWidth);
debug('<br>');
});
</script>
<script src="../../resources/js-test-post.js"></script>