Interface ScriptElement
- All Superinterfaces:
DomQueryable
,Element
,EventTarget
,Node
Script element for adding functionality to Delphi pages with JavaScript.
Notes
-
Once a script element is added, it will be executed immediately. Unless the DOM is
currently being loaded, and
isDeferred()
returns true. -
Removing a script element from the DOM tree does nothing. Similarly, removing its content
or its
src
attribute after the script has been loaded and executed also does nothing. - The JavaScript VM is only closed when the page is closed.
-
JavaScript support needs to be explicitly enabled by going to
/plugins/Delphi/data/scripting.properties
and settingenabled
totrue
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
Get the script source.@Nullable ResourcePath
Get the full source path of the script source file.boolean
Get the value of theAttributes.DEFER
attribute.Methods inherited from interface com.juliewoolie.dom.DomQueryable
getElementsByClassName, getElementsByTagName, querySelector, querySelectorAll
Methods inherited from interface com.juliewoolie.dom.Element
appendChild, appendElement, appendText, canHaveChildren, clearChildren, firstChild, forEachDescendant, getAttribute, getAttributeEntries, getAttributeNames, getChild, getChildCount, getChildren, getClassList, getClassName, getCurrentStyle, getId, getInlineStyle, getTagName, getTextContent, getTitleNode, getTooltip, hasAttribute, hasChild, hasChildren, indexOf, insertAfter, insertBefore, isDescendant, lastChild, matches, prependChild, removeAttribute, removeChild, removeChild, removeMatchingChildren, replaceChild, replaceChild, setAttribute, setClassName, setId, setTextContent, setTitleNode
Methods inherited from interface com.juliewoolie.dom.event.EventTarget
addEventListener, dispatchEvent, getOnAddAttribute, getOnAddOption, getOnAppendChild, getOnAttributeChange, getOnClick, getOnClosing, getOnInput, getOnLoaded, getOnMouseEnter, getOnMouseExit, getOnMouseMove, getOnOptionChange, getOnRemoveAttribute, getOnRemoveChild, getOnRemoveOption, getOnRightClick, getOnSetAttribute, getOnSetOption, getOnSpawned, onAddAttribute, onAddOption, onAppendChild, onAttributeChange, onClick, onClosing, onInput, onLoaded, onMouseEnter, onMouseExit, onMouseMove, onOptionChange, onRemoveAttribute, onRemoveChild, onRemoveOption, onRightClick, onSetAttribute, onSetOption, onSpawned, removeEventListener
Methods inherited from interface com.juliewoolie.dom.Node
enterVisitor, exitVisitor, getDepth, getOwningDocument, getParent, getRenderingBounds, getSiblingIndex, hasFlag, nextSibling, previousSibling
-
Method Details
-
getSource
Get the script source.Shorthand for accessing the
Attributes.SOURCE
attribute.- Returns:
- Script source
-
getSourcePath
Get the full source path of the script source file.- Returns:
- Script source path
-
isDeferred
boolean isDeferred()Get the value of theAttributes.DEFER
attribute.- Returns:
true
, if the defer attribute was set to true,false
otherwise.
-