blob: d3472c331c9d290054cc9093058a458e22609767 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function() {
assert_idl_attribute(document.body, "offsetParent", "offsetParent");
assert_idl_attribute(document.body, "offsetTop", "offsetTop");
assert_idl_attribute(document.body, "offsetLeft", "offsetLeft");
assert_idl_attribute(document.body, "offsetWidth", "offsetWidth");
assert_idl_attribute(document.body, "offsetHeight", "offsetHeight");
}, "HTMLElement should have offset* DIL attributes");
test(function() {
assert_own_property(HTMLElement.prototype, "offsetParent", "offsetParent");
assert_own_property(HTMLElement.prototype, "offsetTop", "offsetTop");
assert_own_property(HTMLElement.prototype, "offsetLeft", "offsetLeft");
assert_own_property(HTMLElement.prototype, "offsetWidth", "offsetWidth");
assert_own_property(HTMLElement.prototype, "offsetHeight", "offsetHeight");
}, "offset* properties on HTMLElement prototype");
test(function() {
assert_equals(Element.prototype.offsetParent, undefined, "offsetParent");
assert_equals(Element.prototype.offsetTop, undefined, "offsetTop");
assert_equals(Element.prototype.offsetLeft, undefined, "offsetLeft");
assert_equals(Element.prototype.offsetWidth, undefined, "offsetWidth");
assert_equals(Element.prototype.offsetHeight, undefined, "offsetHeight");
}, "offset* properties not on Element prototype");
test(function() {
assert_equals(SVGElement.prototype.offsetParent, undefined, "offsetParent");
assert_equals(SVGElement.prototype.offsetTop, undefined, "offsetTop");
assert_equals(SVGElement.prototype.offsetLeft, undefined, "offsetLeft");
assert_equals(SVGElement.prototype.offsetWidth, undefined, "offsetWidth");
assert_equals(SVGElement.prototype.offsetHeight, undefined, "offsetHeight");
}, "offset* properties not on SVGElement prototype");
test(function() {
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
assert_equals(svg.__proto__, SVGSVGElement.prototype, "svg is an SVGSVGElement");
assert_equals(svg.offsetParent, undefined, "offsetParent");
assert_equals(svg.offsetTop, undefined, "offsetTop");
assert_equals(svg.offsetLeft, undefined, "offsetLeft");
assert_equals(svg.offsetWidth, undefined, "offsetWidth");
assert_equals(svg.offsetHeight, undefined, "offsetHeight");
}, "SVGElement should not have offset* IDL attributes");
</script>
</body>
</html>