@JsType(isNative=true, name="Document", namespace="<global>") public class BaseDocument extends BaseNode
BaseEventTarget.EventListenerCallback
Modifier and Type | Method and Description |
---|---|
<T extends BaseHtmlElement> |
createElement(String tagName)
Creates the HTML element specified by tag name.
|
TextNode |
createTextNode(String data)
Creates a new text node which can be used to escape HTML characters.
|
double |
getChildElementCount()
Returns the number of children of this parent node which are elements.
|
BaseElement |
getDocumentElement()
Returns the element that is a direct child of the document.
This is normally the object representing the document's <html< element. |
BaseElement |
getElementById(String id)
Returns an element object representing the element whose id property matches the specified string.
|
NodeList<BaseElement> |
getElementsByTagName(String tagName)
Returns an list of elements with the given tag name.
The complete document is searched, including the root node. |
BaseElement |
getFirstElementChild()
Returns the first node which is both a child of this parent node and is also an element, or
null if there is none. |
Head |
getHead()
Returns the <head> element of the current document.
|
BaseElement |
getLastElementChild()
Returns the last node which is both a child of this parent node and is an element, or
null if there is none. |
BaseElement |
getScrollingElement()
Returns a reference to the element that scrolls the document.
|
appendChild, cloneNode, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, getTextContent, hasChildNodes, insertBefore, removeAllChildren, removeChild, setNodeValue, setTextContent
addEventListener, removeEventListener
@JsProperty public final double getChildElementCount()
@JsProperty public final BaseElement getDocumentElement()
@JsProperty public final BaseElement getFirstElementChild()
null
if there is none.@JsProperty public final Head getHead()
@JsProperty public final BaseElement getLastElementChild()
null
if there is none.@JsProperty public final BaseElement getScrollingElement()
@JsMethod public final <T extends BaseHtmlElement> T createElement(String tagName)
T
- type of HTML element to createtagName
- tag name of the element to create@JsMethod public final TextNode createTextNode(String data)
data
- the string which is containing the data to be put in the text node@JsMethod public final BaseElement getElementById(String id)
id
- the id of the element to locate.@JsMethod public final NodeList<BaseElement> getElementsByTagName(String tagName)
tagName
- tag name of the element to search