servo/tests/wpt/css-tests/cssom-view-1_dev/html/CaretPosition-001.htm

44 lines
No EOL
1.2 KiB
HTML

<!DOCTYPE html>
<html><head>
<title>CSSOM View Module test:CaretPosition</title>
<link href="mailto:tidelgl@gmail.com" rel="author" title="unbug">
<link href="https://drafts.csswg.org/cssom-view-1/#dom-document-elementfrompoint" rel="help">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style type="text/css">
.box{
position: absolute;
top : 100px;
left : 400px;
width: 100px;
height: 100px;
background-color: #000;
}
</style>
</head>
<body>
<div class="box" id="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box" id="box2"></div>
<div style="left: 405px;background:red;" class="box" id="box3"></div>
<div id="log"></div>
<script>
test(function(){
assert_equals(document.elementFromPoint(400, 100),
document.getElementById('box2'),
"Expected value for element id is 'box2'");
}, 'Element at (400, 100)');
test(function(){
assert_equals(document.elementFromPoint(400, 900),
null,
"Expected value for element id is 'box2'");
}, 'Element at (400, 900)');
</script>
</body></html>