mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb: Add missing handler in affected_by_invalidation_property()
...for :placeholder-shown pseudo-class.
This commit is contained in:
parent
aaff6f98b1
commit
9f75e26385
Notes:
github-actions[bot]
2025-01-25 23:53:34 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 9f75e26385
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3365
Reviewed-by: https://github.com/gmta
3 changed files with 34 additions and 0 deletions
|
@ -1169,6 +1169,14 @@ bool Element::affected_by_invalidation_property(CSS::InvalidationSet::Property c
|
||||||
// FIXME: This could be narrowed down to return true only if element is actually checked.
|
// FIXME: This could be narrowed down to return true only if element is actually checked.
|
||||||
return is<HTML::HTMLInputElement>(*this) || is<HTML::HTMLOptionElement>(*this);
|
return is<HTML::HTMLInputElement>(*this) || is<HTML::HTMLOptionElement>(*this);
|
||||||
}
|
}
|
||||||
|
case CSS::PseudoClass::PlaceholderShown: {
|
||||||
|
if (is<HTML::HTMLInputElement>(*this) && has_attribute(HTML::AttributeNames::placeholder)) {
|
||||||
|
auto const& input_element = static_cast<HTML::HTMLInputElement const&>(*this);
|
||||||
|
return input_element.placeholder_element() && input_element.placeholder_value().has_value();
|
||||||
|
}
|
||||||
|
// - FIXME: textarea elements that have a placeholder attribute whose value is currently being presented to the user.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
PASS (didn't crash)
|
|
@ -0,0 +1,25 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<script src="include.js"></script>
|
||||||
|
<style>
|
||||||
|
#b input:placeholder-shown {
|
||||||
|
border: 2px dashed red;
|
||||||
|
background-color: #ffecec;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="a"><input type="text" placeholder=""></input></div>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
document.documentElement.offsetHeight; // force style recalculation
|
||||||
|
const a = document.getElementById('a');
|
||||||
|
a.id = 'b';
|
||||||
|
println("PASS (didn't crash)");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue