Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<title>CSS Values and Units Test: attr() invalidation</title>
<meta name="assert" content="Test attr() invalidation">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
div {
width: attr(data-foo type(<length>));
}
</style>
<html>
<body>
<div id="div" data-foo="10px"></div>
</body>
</html>
<script>
setup({ single_test: true });
let elem = document.getElementById("div");
let old_width = window.getComputedStyle(elem).getPropertyValue("width");
elem.setAttribute("data-foo", "30px");
let new_width = window.getComputedStyle(elem).getPropertyValue("width");
assert_not_equals(new_width, old_width);
done();
</script>