On Mon Jan 9 13:59:56 2023 +0000, Jacek Caban wrote:
If anything, I think the variable should be an element to begin with
(this would move the cast from get_element to GetBody, and get rid of this cast), but I don't think it's worth it as a change. Depends how Jacek feels. Yes, I think it would be better to change variable type.
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.