Skip to content

Commit e07bb32

Browse files
LibJS+LibWeb: Add Object::fast_is<Element>()
1 parent 88d8380 commit e07bb32

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Libraries/LibJS/Runtime/Object.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ class JS_API Object : public Cell
206206
void define_native_accessor(Realm&, PropertyKey const&, ESCAPING Function<ThrowCompletionOr<Value>(VM&)> getter, ESCAPING Function<ThrowCompletionOr<Value>(VM&)> setter, PropertyAttributes attributes);
207207

208208
virtual bool is_dom_node() const { return false; }
209+
virtual bool is_dom_element() const { return false; }
209210
virtual bool is_dom_event() const { return false; }
210211
virtual bool is_html_window() const { return false; }
211212
virtual bool is_html_window_proxy() const { return false; }

Libraries/LibWeb/DOM/Element.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ class WEB_API Element
113113
public:
114114
virtual ~Element() override;
115115

116+
virtual bool is_dom_element() const final { return true; }
117+
116118
FlyString const& qualified_name() const { return m_qualified_name.as_string(); }
117119
FlyString const& html_uppercased_qualified_name() const;
118120

@@ -710,3 +712,6 @@ enum class ValidationContext {
710712
WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm&, Optional<FlyString> namespace_, FlyString const& qualified_name, ValidationContext context);
711713

712714
}
715+
716+
template<>
717+
inline bool JS::Object::fast_is<Web::DOM::Element>() const { return is_dom_element(); }

0 commit comments

Comments
 (0)