blob: 1ae06fb022c8e59c4b99bdb67641b6870693a1ba [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style>
section {
border: 1px solid blue;
padding: 5px;
margin: 5px;
display: inline-block;
width: 150px;
height: 75px;
vertical-align: bottom;
}
section.nosel {
-webkit-user-select: none;
}
</style>
</head>
<body>
<section>
Everything in this box should be selected and the text
should be visible.
</section>
<section class="nosel">
Nothing in this box should be selected and the text
should be visible.
</section>
<section>
Everything in this box should be selected and the text
should be visible.
</section>
<script>
var selection = window.getSelection();
var range = document.createRange();
range.selectNodeContents(document.body);
selection.removeAllRanges();
selection.addRange(range);
</script>
</body>
</html>