mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
LibWeb: Add support for DOM's TreeWalker
This patch adds TreeWalker (created via Document.createTreeWalker()) which allows you to traverse a filtered view of the DOM in all directions.
This commit is contained in:
parent
fabcee016f
commit
acbdb95b0a
9 changed files with 487 additions and 0 deletions
|
@ -35,6 +35,7 @@
|
|||
#include <LibWeb/DOM/Range.h>
|
||||
#include <LibWeb/DOM/ShadowRoot.h>
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
#include <LibWeb/DOM/TreeWalker.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/HTML/AttributeNames.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
|
@ -1467,4 +1468,10 @@ NonnullRefPtr<NodeIterator> Document::create_node_iterator(Node& root, unsigned
|
|||
return NodeIterator::create(root, what_to_show, move(filter));
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createtreewalker
|
||||
NonnullRefPtr<TreeWalker> Document::create_tree_walker(Node& root, unsigned what_to_show, RefPtr<NodeFilter> filter)
|
||||
{
|
||||
return TreeWalker::create(root, what_to_show, move(filter));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue