ladybird/Tests/LibWeb/Text/input/HTML/reflected-integer-attributes.html
Tim Ledbetter 2a7cf1c588 LibWeb: Implement the width and height attributes where missing
This change adds the `width` and `height` properties to
`HTMLVideoElement` and `HTMLSourceElement`. These properties reflect
their respective content attribute values.
2024-05-21 19:28:43 +02:00

29 lines
1,010 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<script>
function setPropertyAndDumpValue(tagName, property, value) {
const element = document.createElement(tagName);
element[property] = value;
println(`${tagName}.${property} after setting to ${value}: ${element[property]}`);
}
function testIntegerReflectedProperty(tagName, property) {
setPropertyAndDumpValue(tagName, property, -1);
setPropertyAndDumpValue(tagName, property, 20);
setPropertyAndDumpValue(tagName, property, 2147483648);
}
test(() => {
for (const tagName of ["img", "marquee", "object"]) {
for (const property of ["hspace", "vspace"]) {
testIntegerReflectedProperty(tagName, property);
}
}
for (const tagName of ["source", "video"]) {
for (const property of ["width", "height"]) {
testIntegerReflectedProperty(tagName, property);
}
}
});
</script>