com.google.gwt.dom.client.Document page = ((Node)jsValue).getOwnerDocument();
if (page == null ) {
com.google.gwt.dom.client.Document doc = (Document)jsValue;
DocType jsDocType = (doc == Document.get())? DocType.UNKNOWN : DocType.NONHTML;
HTMLDocumentWrapper docWrapper = new HTMLDocumentWrapper(doc, doc.getURL(), config, jsDocType);
return SingletonIterator.makeIterator(docWrapper);
} else {
DocType jsDocType = (page == Document.get())? DocType.UNKNOWN : DocType.NONHTML;
HTMLDocumentWrapper htmlDoc = new HTMLDocumentWrapper(page, page.getURL(), config, jsDocType);
HTMLNodeWrapper htmlNode = htmlDoc.wrap((Node) jsValue);
return SingletonIterator.makeIterator(htmlNode);
}
}