<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div id="container">
<span id="innerSpan1">This is in a inline element</span>
<span id="innerSpan2"><span id="innerSpan3"><span id="innerSpan4">This is in culled inline elements</span></span></span>
</div>
<div id="log"></div>
<script>
test(function(t)
{
var span = document.getElementById("innerSpan1");
var x = span.offsetLeft + span.offsetWidth / 2;
var y = span.offsetTop + span.offsetHeight / 2;
var elements = document.elementsFromPoint(x, y);
assert_equals(elements.length, 4);
assert_equals(elements[0].id, 'innerSpan1');
assert_equals(elements[1].id, 'container');
assert_equals(elements[2].nodeName, 'BODY');
assert_equals(elements[3].nodeName, 'HTML');
var span = document.getElementById("innerSpan4");
var x = span.offsetLeft + span.offsetWidth / 2;
var y = span.offsetTop + span.offsetHeight / 2;
var elements = document.elementsFromPoint(x, y);
assert_equals(elements.length, 6);
assert_equals(elements[0].id, 'innerSpan4');
assert_equals(elements[1].id, 'innerSpan3');
assert_equals(elements[2].id, 'innerSpan2');
assert_equals(elements[3].id, 'container');
assert_equals(elements[4].nodeName, 'BODY');
assert_equals(elements[5].nodeName, 'HTML');
}, "elementsFromPoint should return all elements under a point");
</script>