Node.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. /*
  2. * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Badge.h>
  8. #include <AK/JsonObjectSerializer.h>
  9. #include <AK/RefPtr.h>
  10. #include <AK/String.h>
  11. #include <AK/TypeCasts.h>
  12. #include <AK/Vector.h>
  13. #include <LibWeb/DOM/EventTarget.h>
  14. #include <LibWeb/DOM/ExceptionOr.h>
  15. namespace Web::DOM {
  16. enum class NodeType : u16 {
  17. INVALID = 0,
  18. ELEMENT_NODE = 1,
  19. ATTRIBUTE_NODE = 2,
  20. TEXT_NODE = 3,
  21. CDATA_SECTION_NODE = 4,
  22. ENTITY_REFERENCE_NODE = 5,
  23. ENTITY_NODE = 6,
  24. PROCESSING_INSTRUCTION_NODE = 7,
  25. COMMENT_NODE = 8,
  26. DOCUMENT_NODE = 9,
  27. DOCUMENT_TYPE_NODE = 10,
  28. DOCUMENT_FRAGMENT_NODE = 11,
  29. NOTATION_NODE = 12
  30. };
  31. struct GetRootNodeOptions {
  32. bool composed { false };
  33. };
  34. class Node : public EventTarget {
  35. WEB_PLATFORM_OBJECT(Node, EventTarget);
  36. public:
  37. ParentNode* parent_or_shadow_host();
  38. ParentNode const* parent_or_shadow_host() const { return const_cast<Node*>(this)->parent_or_shadow_host(); }
  39. virtual ~Node();
  40. // FIXME: Move cleanup to the regular destructor.
  41. void removed_last_ref();
  42. NodeType type() const { return m_type; }
  43. bool is_element() const { return type() == NodeType::ELEMENT_NODE; }
  44. bool is_text() const { return type() == NodeType::TEXT_NODE; }
  45. bool is_document() const { return type() == NodeType::DOCUMENT_NODE; }
  46. bool is_document_type() const { return type() == NodeType::DOCUMENT_TYPE_NODE; }
  47. bool is_comment() const { return type() == NodeType::COMMENT_NODE; }
  48. bool is_character_data() const { return type() == NodeType::TEXT_NODE || type() == NodeType::COMMENT_NODE; }
  49. bool is_document_fragment() const { return type() == NodeType::DOCUMENT_FRAGMENT_NODE; }
  50. bool is_parent_node() const { return is_element() || is_document() || is_document_fragment(); }
  51. bool is_slottable() const { return is_element() || is_text(); }
  52. bool is_attribute() const { return type() == NodeType::ATTRIBUTE_NODE; }
  53. bool is_cdata_section() const { return type() == NodeType::CDATA_SECTION_NODE; }
  54. virtual bool is_shadow_root() const { return false; }
  55. virtual bool requires_svg_container() const { return false; }
  56. virtual bool is_svg_container() const { return false; }
  57. virtual bool is_svg_svg_element() const { return false; }
  58. bool in_a_document_tree() const;
  59. // NOTE: This is intended for the JS bindings.
  60. u16 node_type() const { return (u16)m_type; }
  61. virtual bool is_editable() const;
  62. virtual bool is_html_element() const { return false; }
  63. virtual bool is_html_html_element() const { return false; }
  64. virtual bool is_html_anchor_element() const { return false; }
  65. virtual bool is_html_base_element() const { return false; }
  66. virtual bool is_html_template_element() const { return false; }
  67. virtual bool is_browsing_context_container() const { return false; }
  68. ExceptionOr<JS::NonnullGCPtr<Node>> pre_insert(JS::NonnullGCPtr<Node>, JS::GCPtr<Node>);
  69. ExceptionOr<JS::NonnullGCPtr<Node>> pre_remove(JS::NonnullGCPtr<Node>);
  70. ExceptionOr<JS::NonnullGCPtr<Node>> append_child(JS::NonnullGCPtr<Node>);
  71. ExceptionOr<JS::NonnullGCPtr<Node>> remove_child(JS::NonnullGCPtr<Node>);
  72. void insert_before(JS::NonnullGCPtr<Node> node, JS::GCPtr<Node> child, bool suppress_observers = false);
  73. void remove(bool suppress_observers = false);
  74. void remove_all_children(bool suppress_observers = false);
  75. u16 compare_document_position(JS::GCPtr<Node> other);
  76. ExceptionOr<JS::NonnullGCPtr<Node>> replace_child(JS::NonnullGCPtr<Node> node, JS::NonnullGCPtr<Node> child);
  77. JS::NonnullGCPtr<Node> clone_node(Document* document = nullptr, bool clone_children = false);
  78. ExceptionOr<JS::NonnullGCPtr<Node>> clone_node_binding(bool deep);
  79. // NOTE: This is intended for the JS bindings.
  80. bool has_child_nodes() const { return has_children(); }
  81. JS::NonnullGCPtr<NodeList> child_nodes();
  82. Vector<JS::Handle<Node>> children_as_vector() const;
  83. virtual FlyString node_name() const = 0;
  84. String base_uri() const;
  85. String descendant_text_content() const;
  86. String text_content() const;
  87. void set_text_content(String const&);
  88. String node_value() const;
  89. void set_node_value(String const&);
  90. Document& document() { return *m_document; }
  91. Document const& document() const { return *m_document; }
  92. HTML::Window& window() const;
  93. JS::GCPtr<Document> owner_document() const;
  94. const HTML::HTMLAnchorElement* enclosing_link_element() const;
  95. const HTML::HTMLElement* enclosing_html_element() const;
  96. const HTML::HTMLElement* enclosing_html_element_with_attribute(FlyString const&) const;
  97. String child_text_content() const;
  98. Node& root();
  99. Node const& root() const
  100. {
  101. return const_cast<Node*>(this)->root();
  102. }
  103. Node& shadow_including_root();
  104. Node const& shadow_including_root() const
  105. {
  106. return const_cast<Node*>(this)->shadow_including_root();
  107. }
  108. bool is_connected() const;
  109. Node* parent_node() { return parent(); }
  110. Node const* parent_node() const { return parent(); }
  111. Element* parent_element();
  112. Element const* parent_element() const;
  113. virtual void inserted();
  114. virtual void removed_from(Node*) { }
  115. virtual void children_changed() { }
  116. virtual void adopted_from(Document&) { }
  117. virtual void cloned(Node&, bool) {};
  118. Layout::Node const* layout_node() const { return m_layout_node; }
  119. Layout::Node* layout_node() { return m_layout_node; }
  120. Painting::PaintableBox const* paint_box() const;
  121. Painting::Paintable const* paintable() const;
  122. void set_layout_node(Badge<Layout::Node>, Layout::Node*) const;
  123. virtual bool is_child_allowed(Node const&) const { return true; }
  124. bool needs_style_update() const { return m_needs_style_update; }
  125. void set_needs_style_update(bool);
  126. bool child_needs_style_update() const { return m_child_needs_style_update; }
  127. void set_child_needs_style_update(bool b) { m_child_needs_style_update = b; }
  128. void invalidate_style();
  129. void set_document(Badge<Document>, Document&);
  130. virtual EventTarget* get_parent(Event const&) override;
  131. template<typename T>
  132. bool fast_is() const = delete;
  133. ExceptionOr<void> ensure_pre_insertion_validity(JS::NonnullGCPtr<Node> node, JS::GCPtr<Node> child) const;
  134. bool is_host_including_inclusive_ancestor_of(Node const&) const;
  135. bool is_scripting_enabled() const;
  136. bool is_scripting_disabled() const;
  137. bool contains(JS::GCPtr<Node>) const;
  138. // Used for dumping the DOM Tree
  139. void serialize_tree_as_json(JsonObjectSerializer<StringBuilder>&) const;
  140. bool is_shadow_including_descendant_of(Node const&) const;
  141. bool is_shadow_including_inclusive_descendant_of(Node const&) const;
  142. bool is_shadow_including_ancestor_of(Node const&) const;
  143. bool is_shadow_including_inclusive_ancestor_of(Node const&) const;
  144. i32 id() const { return m_id; }
  145. static Node* from_id(i32 node_id);
  146. String serialize_fragment() const;
  147. void replace_all(JS::GCPtr<Node>);
  148. void string_replace_all(String const&);
  149. bool is_same_node(Node const*) const;
  150. bool is_equal_node(Node const*) const;
  151. JS::NonnullGCPtr<Node> get_root_node(GetRootNodeOptions const& options = {});
  152. bool is_uninteresting_whitespace_node() const;
  153. String debug_description() const;
  154. size_t length() const;
  155. auto& registered_observers_list() { return m_registered_observer_list; }
  156. auto const& registered_observers_list() const { return m_registered_observer_list; }
  157. void add_registered_observer(RegisteredObserver& registered_observer) { m_registered_observer_list.append(registered_observer); }
  158. void queue_mutation_record(FlyString const& type, String attribute_name, String attribute_namespace, String old_value, JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling);
  159. // https://dom.spec.whatwg.org/#concept-shadow-including-descendant
  160. template<typename Callback>
  161. IterationDecision for_each_shadow_including_descendant(Callback);
  162. Node* parent() { return m_parent.ptr(); }
  163. Node const* parent() const { return m_parent.ptr(); }
  164. bool has_children() const { return m_first_child; }
  165. Node* next_sibling() { return m_next_sibling.ptr(); }
  166. Node* previous_sibling() { return m_previous_sibling.ptr(); }
  167. Node* first_child() { return m_first_child.ptr(); }
  168. Node* last_child() { return m_last_child.ptr(); }
  169. Node const* next_sibling() const { return m_next_sibling.ptr(); }
  170. Node const* previous_sibling() const { return m_previous_sibling.ptr(); }
  171. Node const* first_child() const { return m_first_child.ptr(); }
  172. Node const* last_child() const { return m_last_child.ptr(); }
  173. size_t child_count() const
  174. {
  175. size_t count = 0;
  176. for (auto* child = first_child(); child; child = child->next_sibling())
  177. ++count;
  178. return count;
  179. }
  180. Node* child_at_index(int index)
  181. {
  182. int count = 0;
  183. for (auto* child = first_child(); child; child = child->next_sibling()) {
  184. if (count == index)
  185. return child;
  186. ++count;
  187. }
  188. return nullptr;
  189. }
  190. Node const* child_at_index(int index) const
  191. {
  192. return const_cast<Node*>(this)->child_at_index(index);
  193. }
  194. // https://dom.spec.whatwg.org/#concept-tree-index
  195. size_t index() const
  196. {
  197. // The index of an object is its number of preceding siblings, or 0 if it has none.
  198. size_t index = 0;
  199. for (auto* node = previous_sibling(); node; node = node->previous_sibling())
  200. ++index;
  201. return index;
  202. }
  203. Optional<size_t> index_of_child(Node const& search_child)
  204. {
  205. VERIFY(search_child.parent() == this);
  206. size_t index = 0;
  207. auto* child = first_child();
  208. VERIFY(child);
  209. do {
  210. if (child == &search_child)
  211. return index;
  212. index++;
  213. } while (child && (child = child->next_sibling()));
  214. return {};
  215. }
  216. template<typename ChildType>
  217. Optional<size_t> index_of_child(Node const& search_child)
  218. {
  219. VERIFY(search_child.parent() == this);
  220. size_t index = 0;
  221. auto* child = first_child();
  222. VERIFY(child);
  223. do {
  224. if (!is<ChildType>(child))
  225. continue;
  226. if (child == &search_child)
  227. return index;
  228. index++;
  229. } while (child && (child = child->next_sibling()));
  230. return {};
  231. }
  232. bool is_ancestor_of(Node const&) const;
  233. bool is_inclusive_ancestor_of(Node const&) const;
  234. bool is_descendant_of(Node const&) const;
  235. bool is_inclusive_descendant_of(Node const&) const;
  236. bool is_following(Node const&) const;
  237. void prepend_child(JS::NonnullGCPtr<Node> node);
  238. Node* next_in_pre_order()
  239. {
  240. if (first_child())
  241. return first_child();
  242. Node* node;
  243. if (!(node = next_sibling())) {
  244. node = parent();
  245. while (node && !node->next_sibling())
  246. node = node->parent();
  247. if (node)
  248. node = node->next_sibling();
  249. }
  250. return node;
  251. }
  252. Node* next_in_pre_order(Node const* stay_within)
  253. {
  254. if (first_child())
  255. return first_child();
  256. Node* node = static_cast<Node*>(this);
  257. Node* next = nullptr;
  258. while (!(next = node->next_sibling())) {
  259. node = node->parent();
  260. if (!node || node == stay_within)
  261. return nullptr;
  262. }
  263. return next;
  264. }
  265. Node const* next_in_pre_order() const
  266. {
  267. return const_cast<Node*>(this)->next_in_pre_order();
  268. }
  269. Node const* next_in_pre_order(Node const* stay_within) const
  270. {
  271. return const_cast<Node*>(this)->next_in_pre_order(stay_within);
  272. }
  273. Node* previous_in_pre_order()
  274. {
  275. if (auto* node = previous_sibling()) {
  276. while (node->last_child())
  277. node = node->last_child();
  278. return node;
  279. }
  280. return parent();
  281. }
  282. Node const* previous_in_pre_order() const
  283. {
  284. return const_cast<Node*>(this)->previous_in_pre_order();
  285. }
  286. bool is_before(Node const& other) const
  287. {
  288. if (this == &other)
  289. return false;
  290. for (auto* node = this; node; node = node->next_in_pre_order()) {
  291. if (node == &other)
  292. return true;
  293. }
  294. return false;
  295. }
  296. // https://dom.spec.whatwg.org/#concept-tree-preceding (Object A is 'typename U' and Object B is 'this')
  297. template<typename U>
  298. bool has_preceding_node_of_type_in_tree_order() const
  299. {
  300. for (auto* node = previous_in_pre_order(); node; node = node->previous_in_pre_order()) {
  301. if (is<U>(node))
  302. return true;
  303. }
  304. return false;
  305. }
  306. // https://dom.spec.whatwg.org/#concept-tree-following (Object A is 'typename U' and Object B is 'this')
  307. template<typename U>
  308. bool has_following_node_of_type_in_tree_order() const
  309. {
  310. for (auto* node = next_in_pre_order(); node; node = node->next_in_pre_order()) {
  311. if (is<U>(node))
  312. return true;
  313. }
  314. return false;
  315. }
  316. template<typename Callback>
  317. IterationDecision for_each_in_inclusive_subtree(Callback callback) const
  318. {
  319. if (callback(static_cast<Node const&>(*this)) == IterationDecision::Break)
  320. return IterationDecision::Break;
  321. for (auto* child = first_child(); child; child = child->next_sibling()) {
  322. if (child->for_each_in_inclusive_subtree(callback) == IterationDecision::Break)
  323. return IterationDecision::Break;
  324. }
  325. return IterationDecision::Continue;
  326. }
  327. template<typename Callback>
  328. IterationDecision for_each_in_inclusive_subtree(Callback callback)
  329. {
  330. if (callback(static_cast<Node&>(*this)) == IterationDecision::Break)
  331. return IterationDecision::Break;
  332. for (auto* child = first_child(); child; child = child->next_sibling()) {
  333. if (child->for_each_in_inclusive_subtree(callback) == IterationDecision::Break)
  334. return IterationDecision::Break;
  335. }
  336. return IterationDecision::Continue;
  337. }
  338. template<typename U, typename Callback>
  339. IterationDecision for_each_in_inclusive_subtree_of_type(Callback callback)
  340. {
  341. if (is<U>(static_cast<Node const&>(*this))) {
  342. if (callback(static_cast<U&>(*this)) == IterationDecision::Break)
  343. return IterationDecision::Break;
  344. }
  345. for (auto* child = first_child(); child; child = child->next_sibling()) {
  346. if (child->template for_each_in_inclusive_subtree_of_type<U>(callback) == IterationDecision::Break)
  347. return IterationDecision::Break;
  348. }
  349. return IterationDecision::Continue;
  350. }
  351. template<typename U, typename Callback>
  352. IterationDecision for_each_in_inclusive_subtree_of_type(Callback callback) const
  353. {
  354. if (is<U>(static_cast<Node const&>(*this))) {
  355. if (callback(static_cast<U const&>(*this)) == IterationDecision::Break)
  356. return IterationDecision::Break;
  357. }
  358. for (auto* child = first_child(); child; child = child->next_sibling()) {
  359. if (child->template for_each_in_inclusive_subtree_of_type<U>(callback) == IterationDecision::Break)
  360. return IterationDecision::Break;
  361. }
  362. return IterationDecision::Continue;
  363. }
  364. template<typename Callback>
  365. IterationDecision for_each_in_subtree(Callback callback) const
  366. {
  367. for (auto* child = first_child(); child; child = child->next_sibling()) {
  368. if (child->for_each_in_inclusive_subtree(callback) == IterationDecision::Break)
  369. return IterationDecision::Break;
  370. }
  371. return IterationDecision::Continue;
  372. }
  373. template<typename Callback>
  374. IterationDecision for_each_in_subtree(Callback callback)
  375. {
  376. for (auto* child = first_child(); child; child = child->next_sibling()) {
  377. if (child->for_each_in_inclusive_subtree(callback) == IterationDecision::Break)
  378. return IterationDecision::Break;
  379. }
  380. return IterationDecision::Continue;
  381. }
  382. template<typename U, typename Callback>
  383. IterationDecision for_each_in_subtree_of_type(Callback callback)
  384. {
  385. for (auto* child = first_child(); child; child = child->next_sibling()) {
  386. if (child->template for_each_in_inclusive_subtree_of_type<U>(callback) == IterationDecision::Break)
  387. return IterationDecision::Break;
  388. }
  389. return IterationDecision::Continue;
  390. }
  391. template<typename U, typename Callback>
  392. IterationDecision for_each_in_subtree_of_type(Callback callback) const
  393. {
  394. for (auto* child = first_child(); child; child = child->next_sibling()) {
  395. if (child->template for_each_in_inclusive_subtree_of_type<U>(callback) == IterationDecision::Break)
  396. return IterationDecision::Break;
  397. }
  398. return IterationDecision::Continue;
  399. }
  400. template<typename Callback>
  401. void for_each_child(Callback callback) const
  402. {
  403. return const_cast<Node*>(this)->template for_each_child(move(callback));
  404. }
  405. template<typename Callback>
  406. void for_each_child(Callback callback)
  407. {
  408. for (auto* node = first_child(); node; node = node->next_sibling())
  409. callback(*node);
  410. }
  411. template<typename U, typename Callback>
  412. void for_each_child_of_type(Callback callback)
  413. {
  414. for (auto* node = first_child(); node; node = node->next_sibling()) {
  415. if (is<U>(node))
  416. callback(verify_cast<U>(*node));
  417. }
  418. }
  419. template<typename U, typename Callback>
  420. void for_each_child_of_type(Callback callback) const
  421. {
  422. return const_cast<Node*>(this)->template for_each_child_of_type<U>(move(callback));
  423. }
  424. template<typename U>
  425. U const* next_sibling_of_type() const
  426. {
  427. return const_cast<Node*>(this)->template next_sibling_of_type<U>();
  428. }
  429. template<typename U>
  430. inline U* next_sibling_of_type()
  431. {
  432. for (auto* sibling = next_sibling(); sibling; sibling = sibling->next_sibling()) {
  433. if (is<U>(*sibling))
  434. return &verify_cast<U>(*sibling);
  435. }
  436. return nullptr;
  437. }
  438. template<typename U>
  439. U const* previous_sibling_of_type() const
  440. {
  441. return const_cast<Node*>(this)->template previous_sibling_of_type<U>();
  442. }
  443. template<typename U>
  444. U* previous_sibling_of_type()
  445. {
  446. for (auto* sibling = previous_sibling(); sibling; sibling = sibling->previous_sibling()) {
  447. if (is<U>(*sibling))
  448. return &verify_cast<U>(*sibling);
  449. }
  450. return nullptr;
  451. }
  452. template<typename U>
  453. U const* first_child_of_type() const
  454. {
  455. return const_cast<Node*>(this)->template first_child_of_type<U>();
  456. }
  457. template<typename U>
  458. U const* last_child_of_type() const
  459. {
  460. return const_cast<Node*>(this)->template last_child_of_type<U>();
  461. }
  462. template<typename U>
  463. U* first_child_of_type()
  464. {
  465. for (auto* child = first_child(); child; child = child->next_sibling()) {
  466. if (is<U>(*child))
  467. return &verify_cast<U>(*child);
  468. }
  469. return nullptr;
  470. }
  471. template<typename U>
  472. U* last_child_of_type()
  473. {
  474. for (auto* child = last_child(); child; child = child->previous_sibling()) {
  475. if (is<U>(*child))
  476. return &verify_cast<U>(*child);
  477. }
  478. return nullptr;
  479. }
  480. template<typename U>
  481. bool has_child_of_type() const
  482. {
  483. return first_child_of_type<U>() != nullptr;
  484. }
  485. template<typename U>
  486. U const* first_ancestor_of_type() const
  487. {
  488. return const_cast<Node*>(this)->template first_ancestor_of_type<U>();
  489. }
  490. template<typename U>
  491. U* first_ancestor_of_type()
  492. {
  493. for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
  494. if (is<U>(*ancestor))
  495. return &verify_cast<U>(*ancestor);
  496. }
  497. return nullptr;
  498. }
  499. bool is_parent_of(Node const& other) const
  500. {
  501. for (auto* child = first_child(); child; child = child->next_sibling()) {
  502. if (&other == child)
  503. return true;
  504. }
  505. return false;
  506. }
  507. protected:
  508. Node(JS::Realm&, Document&, NodeType);
  509. Node(Document&, NodeType);
  510. virtual void visit_edges(Cell::Visitor&) override;
  511. JS::GCPtr<Document> m_document;
  512. mutable WeakPtr<Layout::Node> m_layout_node;
  513. NodeType m_type { NodeType::INVALID };
  514. bool m_needs_style_update { false };
  515. bool m_child_needs_style_update { false };
  516. i32 m_id;
  517. // https://dom.spec.whatwg.org/#registered-observer-list
  518. // "Nodes have a strong reference to registered observers in their registered observer list." https://dom.spec.whatwg.org/#garbage-collection
  519. Vector<RegisteredObserver&> m_registered_observer_list;
  520. private:
  521. void queue_tree_mutation_record(JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling);
  522. void insert_before_impl(JS::NonnullGCPtr<Node>, JS::GCPtr<Node> child);
  523. void append_child_impl(JS::NonnullGCPtr<Node>);
  524. void remove_child_impl(JS::NonnullGCPtr<Node>);
  525. JS::GCPtr<Node> m_parent;
  526. JS::GCPtr<Node> m_first_child;
  527. JS::GCPtr<Node> m_last_child;
  528. JS::GCPtr<Node> m_next_sibling;
  529. JS::GCPtr<Node> m_previous_sibling;
  530. };
  531. }
  532. WRAPPER_HACK(Node, Web::DOM)