mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 23:25:08 +00:00
LibHTML: Basic element attribute parsing.
This commit is contained in:
parent
581d6b00c8
commit
f8a86b5164
5 changed files with 194 additions and 17 deletions
|
@ -12,7 +12,11 @@ void dump_tree(Node& node)
|
|||
if (node.is_document()) {
|
||||
printf("*Document*\n");
|
||||
} else if (node.is_element()) {
|
||||
printf("<%s>\n", static_cast<Element&>(node).tag_name().characters());
|
||||
printf("<%s", static_cast<Element&>(node).tag_name().characters());
|
||||
static_cast<Element&>(node).for_each_attribute([](auto& name, auto& value) {
|
||||
printf(" %s=%s", name.characters(), value.characters());
|
||||
});
|
||||
printf(">\n");
|
||||
} else if (node.is_text()) {
|
||||
printf("\"%s\"\n", static_cast<Text&>(node).data().characters());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue