mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:17:44 +00:00
LibWeb: Make Serialize functions infallible
This commit is contained in:
parent
788c2c5a8d
commit
b5893ee115
10 changed files with 95 additions and 105 deletions
|
@ -130,7 +130,7 @@ ErrorOr<String> Selector::SimpleSelector::serialize() const
|
|||
// namespace (not in a namespace) append the serialization of the namespace prefix as an identifier,
|
||||
// followed by a "|" (U+007C) to s.
|
||||
if (qualified_name.namespace_type == QualifiedName::NamespaceType::Named) {
|
||||
TRY(serialize_an_identifier(s, qualified_name.namespace_));
|
||||
serialize_an_identifier(s, qualified_name.namespace_);
|
||||
TRY(s.try_append('|'));
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ ErrorOr<String> Selector::SimpleSelector::serialize() const
|
|||
|
||||
// 3. If this is a type selector append the serialization of the element name as an identifier to s.
|
||||
if (type == Selector::SimpleSelector::Type::TagName)
|
||||
TRY(serialize_an_identifier(s, qualified_name.name.name));
|
||||
serialize_an_identifier(s, qualified_name.name.name);
|
||||
|
||||
// 4. If this is a universal selector append "*" (U+002A) to s.
|
||||
if (type == Selector::SimpleSelector::Type::Universal)
|
||||
|
@ -158,12 +158,12 @@ ErrorOr<String> Selector::SimpleSelector::serialize() const
|
|||
// 2. If the namespace prefix maps to a namespace that is not the null namespace (not in a namespace)
|
||||
// append the serialization of the namespace prefix as an identifier, followed by a "|" (U+007C) to s.
|
||||
if (attribute.qualified_name.namespace_type == QualifiedName::NamespaceType::Named) {
|
||||
TRY(serialize_an_identifier(s, attribute.qualified_name.namespace_));
|
||||
serialize_an_identifier(s, attribute.qualified_name.namespace_);
|
||||
TRY(s.try_append('|'));
|
||||
}
|
||||
|
||||
// 3. Append the serialization of the attribute name as an identifier to s.
|
||||
TRY(serialize_an_identifier(s, attribute.qualified_name.name.name));
|
||||
serialize_an_identifier(s, attribute.qualified_name.name.name);
|
||||
|
||||
// 4. If there is an attribute value specified, append "=", "~=", "|=", "^=", "$=", or "*=" as appropriate (depending on the type of attribute selector),
|
||||
// followed by the serialization of the attribute value as a string, to s.
|
||||
|
@ -191,7 +191,7 @@ ErrorOr<String> Selector::SimpleSelector::serialize() const
|
|||
break;
|
||||
}
|
||||
|
||||
TRY(serialize_a_string(s, attribute.value));
|
||||
serialize_a_string(s, attribute.value);
|
||||
}
|
||||
|
||||
// 5. If the attribute selector has the case-insensitivity flag present, append " i" (U+0020 U+0069) to s.
|
||||
|
@ -216,13 +216,13 @@ ErrorOr<String> Selector::SimpleSelector::serialize() const
|
|||
case Selector::SimpleSelector::Type::Class:
|
||||
// Append a "." (U+002E), followed by the serialization of the class name as an identifier to s.
|
||||
TRY(s.try_append('.'));
|
||||
TRY(serialize_an_identifier(s, name()));
|
||||
serialize_an_identifier(s, name());
|
||||
break;
|
||||
|
||||
case Selector::SimpleSelector::Type::Id:
|
||||
// Append a "#" (U+0023), followed by the serialization of the ID as an identifier to s.
|
||||
TRY(s.try_append('#'));
|
||||
TRY(serialize_an_identifier(s, name()));
|
||||
serialize_an_identifier(s, name());
|
||||
break;
|
||||
|
||||
case Selector::SimpleSelector::Type::PseudoClass: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue