示例#1
0
DOMHTMLElement* DOMHTMLDocument::body()
{
    if (!m_document || !m_document->isHTMLDocument())
        return 0;

    HTMLDocument* htmlDoc = static_cast<HTMLDocument*>(m_document);
    return new DOMHTMLElement(htmlDoc->body());
}
HRESULT STDMETHODCALLTYPE DOMHTMLDocument::body( 
        /* [retval][out] */ IDOMHTMLElement** bodyElement)
{
    *bodyElement = 0;
    if (!m_document || !m_document->isHTMLDocument())
        return E_FAIL;

    HTMLDocument* htmlDoc = static_cast<HTMLDocument*>(m_document);
    COMPtr<IDOMElement> domElement;
    domElement.adoptRef(DOMHTMLElement::createInstance(htmlDoc->body()));
    if (domElement)
        return domElement->QueryInterface(IID_IDOMHTMLElement, (void**) bodyElement);
    return E_FAIL;
}