diff --git a/content/base/public/Element.h b/content/base/public/Element.h index e378d373759c..8d474a4aa741 100644 --- a/content/base/public/Element.h +++ b/content/base/public/Element.h @@ -265,4 +265,10 @@ inline mozilla::dom::Element* nsINode::AsElement() return static_cast(this); } +inline const mozilla::dom::Element* nsINode::AsElement() const +{ + MOZ_ASSERT(IsElement()); + return static_cast(this); +} + #endif // mozilla_dom_Element_h__ diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index ef833f52de0c..8ae8309c227a 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -373,6 +373,7 @@ public: * for which IsElement() is true. This is defined inline in Element.h. */ mozilla::dom::Element* AsElement(); + const mozilla::dom::Element* AsElement() const; /** * Return this node as nsIContent. Should only be used for nodes for which