ULElement

open class ULElement(parent: Element) : Element

Functions

activate
Link copied to clipboard
fun activate(): Element
addClasses
Link copied to clipboard
fun addClasses(vararg classes: String, onlyIf: Boolean = true): Element
A convenience function to append a class to an existing class attribute.
addEventListener
Link copied to clipboard
open override fun addEventListener(eventName: String, returnEventFields: Set<String>, retrieveJs: String?, preventDefault: Boolean, callback: (JsonElement) -> Unit): Element
addImmediateEventCode
Link copied to clipboard
open override fun addImmediateEventCode(eventName: String, jsCode: String)
addText
Link copied to clipboard
fun addText(value: String): Element
assertPluginLoaded
Link copied to clipboard
fun assertPluginLoaded(vararg plugins: KClass<out KwebPlugin>)
Requires that a specific plugin or plugins be loaded by listing them in the plugins parameter of the Kweb constructor.
bind
Link copied to clipboard
fun bind(accessor: (elementId: String) -> String, updateOnEvent: String, initialValue: JsonElement = JsonPrimitive("")): KVar<JsonElement>
Return a KVar that is tied to a property related to an element, which will update when an specified event fires on this element.
fun bind(reader: (elementId: String) -> String, writer: (elementId: String, value: String) -> String, updateOnEvent: String, initialValue: JsonElement = JsonPrimitive("")): KVar<JsonElement>
Return a KVar that is tied to a property related to an element, which will update when an specified event fires on this element.
blur
Link copied to clipboard
fun blur(): Element
callJsFunction
Link copied to clipboard
fun callJsFunction(js: String, vararg args: JsonElement)
Execute some JavaScript in the browser.
callJsFunctionWithResult
Link copied to clipboard
suspend fun <O> callJsFunctionWithResult(js: String, outputMapper: (JsonElement) -> O, vararg args: JsonElement): O?
Evaluate some JavaScript in the browser and return the result via a Future.
classes
Link copied to clipboard
fun classes(vararg value: String): Element
A convenience function to set the class attribute, this is a wrapper around setAttribute.
fun classes(value: KVal<String>): Element
A convenience function to set the class attribute, this is a wrapper around setAttribute.
deactivate
Link copied to clipboard
fun deactivate(): Element
delete
Link copied to clipboard
fun delete()
Remove this element by calling removeChild on its parent element.
deleteIfExists
Link copied to clipboard
fun deleteIfExists()
Remove this element by calling removeChild on its parent element if it exists.
disable
Link copied to clipboard
fun disable(): Element
enable
Link copied to clipboard
fun enable(): Element
focus
Link copied to clipboard
fun focus(): Element
innerHTML
Link copied to clipboard
fun innerHTML(html: String): Element
Sets the innerHTML property of a DOM element.
fun innerHTML(html: KVal<String>): Element
Sets the innerHTML property of a DOM element.
on
Link copied to clipboard
fun on(retrieveJs: String? = null, preventDefault: Boolean = false): OnReceiver<Element>
See here.
plugin
Link copied to clipboard
fun <P : KwebPlugin> plugin(plugin: KClass<P>): P
Obtain the instance of a plugin by its KClass.
removeAttribute
Link copied to clipboard
fun removeAttribute(name: String): Element
removeChildAt
Link copied to clipboard
fun removeChildAt(position: Int): Element
removeChildren
Link copied to clipboard
fun removeChildren(): Element
removeClasses
Link copied to clipboard
fun removeClasses(vararg classes: String, onlyIf: Boolean = true): Element
A convenience function to remove one or more classes from an existing class attribute.
setAttribute
Link copied to clipboard
fun setAttribute(name: String, value: Boolean): Element
fun setAttribute(name: String, value: Number): Element
fun setAttribute(name: String, value: String): Element
fun setAttribute(name: String, oValue: KVal<out JsonPrimitive>): Element
Set an attribute to the value in a KVal, if the value changes the attribute value will be updated automatically.
fun setAttribute(name: String, value: JsonPrimitive, namespace: String? = null): Element
Set an attribute of this element.
setAttributeRaw
Link copied to clipboard
fun setAttributeRaw(name: String, value: Boolean): Element
fun setAttributeRaw(name: String, value: Number): Element
fun setAttributeRaw(name: String, value: String): Element
fun setAttributeRaw(name: String, value: JsonPrimitive): Element
setAttributes
Link copied to clipboard
fun setAttributes(vararg pair: Pair<String, JsonPrimitive>): Element
A utility function to set multiple attributes in a single call, in the style of mapOf.
setClasses
Link copied to clipboard
fun setClasses(vararg value: String): Element
A convenience function to set the class attribute, this is a wrapper around setAttribute.
spellcheck
Link copied to clipboard
fun spellcheck(spellcheck: Boolean = true): Element
Determines whether this element will be spellchecked.
text
Link copied to clipboard
fun text(value: String): Element
Set the text of this element to value.
fun text(text: KVal<String>): Element
Set the text of this element to an KVal value.

Properties

browser
Link copied to clipboard
open override val browser: WebBrowser
creator
Link copied to clipboard
val creator: ElementCreator<*>?
flags
Link copied to clipboard
val flags: ConcurrentSkipListSet<String>
id
Link copied to clipboard
var id: String
on
Link copied to clipboard
val on: OnReceiver<Element>
See here.
onImmediate
Link copied to clipboard
val onImmediate: OnImmediateReceiver<Element>
See here.
read
Link copied to clipboard
open val read: ElementReader
Obtain an ElementReader that can be used to read various properties of this element.
style
Link copied to clipboard
val style: StyleReceiver
Some convenience functions for modifying an element's style attribute.
tag
Link copied to clipboard
val tag: String? = null
text
Link copied to clipboard
var text: KVar<String>