On Mon Jan 9 17:37:16 2023 +0000, Santino Mazza wrote:
If I change the variable type to nsIDOMElement I will have to down-cast nsbody to nsIDOMHTMLElement for GetBody, I suppose in this case is not really a problem because we are assigning it a new object and not using it. But when I have to Release the element, is it okay to use nsIDOMElement_Release(nsbody)? Because I created the nsbody using GetBody which returns an nsIDOMHTMLElement, and even though the type is nsIDOMElement, at the end it's an nsIDOMHTMLElement, so I'm not sure if we could be leaking something.
nsIDOMHTMLElement inherits from nsIDOMElement so it's perfectly fine. Also, they all inherit from nsISupports (which is basically IUnknown), anyway. You can quickly see this in `nsiface.idl`.