mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:07:34 +00:00
LibWeb: Add fast_is<T>() for some common DOM Node subclasses
This commit is contained in:
parent
02e2f11380
commit
b0955fd269
5 changed files with 15 additions and 0 deletions
|
@ -23,4 +23,7 @@ public:
|
||||||
static NonnullRefPtr<Comment> create_with_global_object(Bindings::WindowObject& window, String const& data);
|
static NonnullRefPtr<Comment> create_with_global_object(Bindings::WindowObject& window, String const& data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline bool Node::fast_is<Comment>() const { return is_comment(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,4 +36,7 @@ private:
|
||||||
WeakPtr<Element> m_host;
|
WeakPtr<Element> m_host;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline bool Node::fast_is<DocumentFragment>() const { return is_document_fragment(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,4 +43,7 @@ private:
|
||||||
String m_system_id;
|
String m_system_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline bool Node::fast_is<DocumentType>() const { return is_document_type(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,4 +26,7 @@ private:
|
||||||
String m_target;
|
String m_target;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline bool Node::fast_is<ProcessingInstruction>() const { return node_type() == (u16)NodeType::PROCESSING_INSTRUCTION_NODE; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,4 +38,7 @@ private:
|
||||||
bool m_always_editable { false };
|
bool m_always_editable { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline bool Node::fast_is<Text>() const { return is_text(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue