.color) [8,96 102x22]
PaintableWithLines (BlockContainer(anonymous)) [8,118 784x0]
+ PaintableWithLines (BlockContainer
.color) [8,118 102x22]
+ PaintableWithLines (BlockContainer(anonymous)) [8,140 784x0]
diff --git a/Tests/LibWeb/Layout/input/css-attr-typed-fallback.html b/Tests/LibWeb/Layout/input/css-attr-typed-fallback.html
index 56f4e90676..949b020c7e 100644
--- a/Tests/LibWeb/Layout/input/css-attr-typed-fallback.html
+++ b/Tests/LibWeb/Layout/input/css-attr-typed-fallback.html
@@ -9,6 +9,9 @@
.string::before {
content: attr(foo string, "WHF!");
}
+ .string-no-fallback::before {
+ content: attr(foo string);
+ }
.length {
width: attr(foo length, 200px);
}
@@ -20,6 +23,7 @@
}
+
diff --git a/Tests/LibWeb/Ref/css-attr-typed-fallback.html b/Tests/LibWeb/Ref/css-attr-typed-fallback.html
index 56f4e90676..949b020c7e 100644
--- a/Tests/LibWeb/Ref/css-attr-typed-fallback.html
+++ b/Tests/LibWeb/Ref/css-attr-typed-fallback.html
@@ -9,6 +9,9 @@
.string::before {
content: attr(foo string, "WHF!");
}
+ .string-no-fallback::before {
+ content: attr(foo string);
+ }
.length {
width: attr(foo length, 200px);
}
@@ -20,6 +23,7 @@
}
+
diff --git a/Tests/LibWeb/Ref/css-attr-typed.html b/Tests/LibWeb/Ref/css-attr-typed.html
index 469e1186bb..58ee1944fd 100644
--- a/Tests/LibWeb/Ref/css-attr-typed.html
+++ b/Tests/LibWeb/Ref/css-attr-typed.html
@@ -20,6 +20,7 @@
}
+
diff --git a/Tests/LibWeb/Ref/reference/css-attr-typed-ref.html b/Tests/LibWeb/Ref/reference/css-attr-typed-ref.html
index cefc680839..9e014c4791 100644
--- a/Tests/LibWeb/Ref/reference/css-attr-typed-ref.html
+++ b/Tests/LibWeb/Ref/reference/css-attr-typed-ref.html
@@ -16,6 +16,7 @@
}
WHF!
+
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index 1c2d7e47b1..8f34b3975c 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -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
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;
}