mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
JSSpecCompiler: Push ParseError out of SpecFunction
This commit is contained in:
parent
32f601f9a4
commit
d339ad01bb
5 changed files with 76 additions and 70 deletions
|
@ -16,7 +16,7 @@ bool contains_empty_text(XML::Node const* node)
|
|||
return node->as_text().builder.string_view().trim_whitespace().is_empty();
|
||||
}
|
||||
|
||||
ParseErrorOr<StringView> get_attribute_by_name(XML::Node const* node, StringView attribute_name)
|
||||
ParseErrorOr<StringView> deprecated_get_attribute_by_name(XML::Node const* node, StringView attribute_name)
|
||||
{
|
||||
auto const& attribute = node->as_element().attributes.get(attribute_name);
|
||||
|
||||
|
@ -25,6 +25,15 @@ ParseErrorOr<StringView> get_attribute_by_name(XML::Node const* node, StringView
|
|||
return attribute.value();
|
||||
}
|
||||
|
||||
Optional<StringView> get_attribute_by_name(XML::Node const* node, StringView attribute_name)
|
||||
{
|
||||
auto const& attribute = node->as_element().attributes.get(attribute_name);
|
||||
|
||||
if (!attribute.has_value())
|
||||
return {};
|
||||
return attribute.value();
|
||||
}
|
||||
|
||||
ParseErrorOr<StringView> get_text_contents(XML::Node const* node)
|
||||
{
|
||||
auto const& children = node->as_element().children;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue