On 3/4/14 7:31 PM, Robert O'Callahan wrote:
Even when you just need instanceof, can it be shortened to
   if (HTMLTitleElement::hasInstance(element))
?

Note that in Gecko that instanceof check would be:

  element->IsHTML(nsGkAtoms::title)

While there are more longhand ways to decompose the checks that's performing for callers who already know they have an HTML element and think they're peformance-sensitive, there is also great value in having it be very clear exactly what's being checked in the common case. If we could have written:

  element->IsHTMLTitle()

without having to handcode a bunch of little methods, we would have done that too, in Gecko.

We do in fact have a numberof HTMLFooElement::FromContent() methods in Gecko that return a HTMLFooElement* (possibly null if the thing passed in wasn't an actual HTMLFooElement).

-Boris

_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to