Package com.teamdev.jxbrowser.dom
Interface Document
- All Superinterfaces:
EventTarget
,Node
,SearchContext
An HTML DOM document.
-
Method Summary
Modifier and TypeMethodDescriptionbaseUri()
Returns a string that represents the<base>
element'shref
attribute if one is present.createElement
(String tagName) Creates and returns a new DOM element with the giventagName
.createEvent
(EventType eventType, EventParams params) createKeyDownEvent
(KeyEventParams params) createKeyPressEvent
(KeyEventParams params) createKeyUpEvent
(KeyEventParams params) createMouseEvent
(EventType eventType, MouseEventParams params) Creates and returns a newMouseEvent
object with the giveneventType
andparams
.Creates and returns aNode
object representing a new text node with an empty node value.createTextNode
(String text) Creates and returns aNode
object representing a new text node initialized with the giventext
value.createWheelEvent
(EventType eventType, WheelEventParams params) Creates and returns a newWheelEvent
object with the giveneventType
andparams
.Returns anOptional
that contains the document HTML element that usually represents HTML tag, otherwise an emptyOptional
if the document element is not available.Returns anOptional
that contains the currently focused element in the document, otherwise an emptyOptional
if there is no focused element in this document.frame()
Returns theFrame
instance of this document.Methods inherited from interface com.teamdev.jxbrowser.dom.event.EventTarget
addEventListener, dispatch, eventListeners, removeEventListener
Methods inherited from interface com.teamdev.jxbrowser.dom.Node
appendChild, children, click, close, compareDocumentPosition, document, evaluate, evaluate, insertChild, nextSibling, nodeName, nodeValue, nodeValue, parent, previousSibling, removeChild, replaceChild, textContent, textContent, type, xPath
Methods inherited from interface com.teamdev.jxbrowser.dom.SearchContext
findElementByClassName, findElementByCssSelector, findElementById, findElementByName, findElementByTagName, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByName, findElementsByTagName
-
Method Details
-
frame
Frame frame()Returns theFrame
instance of this document. -
documentElement
Returns anOptional
that contains the document HTML element that usually represents HTML tag, otherwise an emptyOptional
if the document element is not available.- Throws:
ObjectClosedException
- when the document is closed
-
createElement
Creates and returns a new DOM element with the giventagName
.- Parameters:
tagName
- a string that represents a tag name (e.g. "A", "P", "DIV") of the new DOM element- Returns:
- a new
Element
instance - Throws:
IllegalArgumentException
- whentagName
is empty or blankObjectClosedException
- when the document is closed
-
createTextNode
Node createTextNode()Creates and returns aNode
object representing a new text node with an empty node value.- Throws:
ObjectClosedException
- when the document is closed
-
createTextNode
Creates and returns aNode
object representing a new text node initialized with the giventext
value.- Parameters:
text
- the node value- Throws:
ObjectClosedException
- when the document is closed
-
createEvent
- Parameters:
eventType
- anEventType
object representing a type of a DOM event supported by engineparams
- anEventParams
object representing DOM event properties (e.g. bubbles, cancellable)- Throws:
ObjectClosedException
- when the document is closed- See Also:
-
createMouseEvent
Creates and returns a newMouseEvent
object with the giveneventType
andparams
.- Parameters:
eventType
- anEventType
object representing a type of a valid DOM event supported by engineparams
- anMouseEventParams
object representing mouse event properties- Returns:
- a new
MouseEvent
object - Throws:
IllegalArgumentException
- if the event creation failed due to the invalid event paramsObjectClosedException
- when the document is closed
-
createWheelEvent
Creates and returns a newWheelEvent
object with the giveneventType
andparams
.- Parameters:
eventType
- anEventType
object representing a type of a valid DOM event supported by engineparams
- anWheelEventParams
object representing wheel event properties- Returns:
- a new
WheelEvent
object - Throws:
IllegalArgumentException
- if the event creation failed due to the invalid event paramsObjectClosedException
- when the document is closed
-
createKeyUpEvent
- Parameters:
params
- the key event parameters- Returns:
- a new
KeyEvent
instance - Throws:
IllegalArgumentException
- if the event creation has been failedObjectClosedException
- when the document is closed
-
createKeyDownEvent
- Parameters:
params
- the key event parameters- Returns:
- a new
KeyEvent
instance - Throws:
IllegalArgumentException
- if the event creation has been failedObjectClosedException
- when the document is closed
-
createKeyPressEvent
- Parameters:
params
- the key event parameters- Returns:
- a new
KeyEvent
instance - Throws:
IllegalArgumentException
- if the event creation has been failedObjectClosedException
- when the document is closed
-
baseUri
String baseUri()Returns a string that represents the<base>
element'shref
attribute if one is present. If the currently loaded document does not have the<base>
element, the method returns URL of the currently loaded document including "about:blank" when nothing is loaded.- Throws:
ObjectClosedException
- when the document is closed
-
focusedElement
Returns anOptional
that contains the currently focused element in the document, otherwise an emptyOptional
if there is no focused element in this document.- Throws:
ObjectClosedException
- when the document is closed- Since:
- 7.10
-