mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-15 14:02:20 +00:00
LibWeb: Default to an empty string when a string attr substitution fails
When a string-type attr() substitution produces no value and no fallback had been specified, the spec mandates we default to the empty string.
This commit is contained in:
parent
4ced84a548
commit
bf1c82724f
Notes:
sideshowbarker
2024-07-16 23:34:49 +09:00
Author: https://github.com/trflynn89
Commit: bf1c82724f
Pull-request: https://github.com/SerenityOS/serenity/pull/23985
Issue: https://github.com/SerenityOS/serenity/issues/23939
6 changed files with 34 additions and 10 deletions
|
@ -7450,6 +7450,12 @@ bool Parser::substitute_attr_function(DOM::Element& element, FlyString const& pr
|
|||
if (has_fallback_values)
|
||||
return expand_unresolved_values(element, property_name, attr_contents, dest);
|
||||
|
||||
if (attribute_type.equals_ignoring_ascii_case("string"_fly_string)) {
|
||||
// If the <attr-type> argument is string, defaults to the empty string if omitted
|
||||
dest.empend(Token::create_string({}));
|
||||
return true;
|
||||
}
|
||||
|
||||
// 3. Otherwise, the property containing the attr() function is invalid at computed-value time.
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue