Re: IsElement() and nsIElement

Ehsan Akhgari <[email protected]> Thu, 22 Apr 2010 23:14:55 -0400
Newsgroups gmane.comp.mozilla.devel.dom
Message-ID <[email protected]>
On Thu, Apr 22, 2010 at 11:01 PM, Boris Zbarsky <[email protected]> wrote:
> So I'm looking at creating a non-virtual IsElement().
>
> While examining the callsites, it seems like a lot of the use is in
> assertions in places where we want to be sure we're dealing with an Element
> node.  Would it make sense to create an nsIElement for now, sitting between
> nsIContent and nsGenericElement, to just enforce this sort of invariant in
> function signatures?  Or should we just make such functions take
> nsGenericElement arguments?  Or maybe that plus rename nsGenericElement to
> mozilla::dom::Element or something?

I've been frustrated more than once because we don't provide any
obvious way of passing elements around, instead of passing an
nsIContent and letting the function ensure that it's getting an
element.  However, I think passing elements as nsGenericElement is a
mistake, because it's a concerete class with lots of implementation
details, which not all callers would need.  Hence, I think adding an
nsIElement makes a lot of sense.

--
Ehsan
<http://ehsanakhgari.org/>
_______________________________________________
dev-tech-dom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-dom