ImageElement

open class ImageElement(parent: Element) : Element(source)

Constructors

Link copied to clipboard
constructor(parent: Element)

Properties

Link copied to clipboard
open override val browser: WebBrowser
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Some convenience functions for modifying an element's style attribute.

Link copied to clipboard
val tag: String? = null
Link copied to clipboard

Functions

Link copied to clipboard
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.

Link copied to clipboard
open override fun addEventListener(eventName: String, returnEventFields: Set<String>, retrieveJs: String?, preventDefault: Boolean, callback: (JsonElement) -> Unit): Element
Link copied to clipboard
open override fun addImmediateEventCode(eventName: String, jsCode: String)
Link copied to clipboard
fun addText(value: String): Element
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.

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. This is a convenience wrapper around bind.

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.

Link copied to clipboard
fun blur(): Element
Link copied to clipboard
fun classes(vararg value: String): Element

A convenience function to set the class attribute, this is a wrapper around set.

fun classes(value: KVal<String>): Element

A convenience function to set the class attribute, this is a wrapper around setAttribute.

Link copied to clipboard
Link copied to clipboard
fun delete()

Remove this element by calling removeChild on its parent element. An error will occur in the browser if the element doesn't exist.

Link copied to clipboard

Remove this element by calling removeChild on its parent element if it exists.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Selects the element based on id, then executes the provided js

Link copied to clipboard
fun focus(): Element
Link copied to clipboard

Sets the innerHTML property of a DOM element.

Sets the innerHTML property of a DOM element. This will be updated automatically if the value of html changes.

Link copied to clipboard
fun Element.jquery(selector: String = "#"): JQueryReceiver

Created by ian on 2/22/17.

Link copied to clipboard
fun on(retrieveJs: String? = null, preventDefault: Boolean = false): OnReceiver<Element>

See here.

Link copied to clipboard
fun <P : KwebPlugin> plugin(plugin: KClass<P>): P

Obtain the instance of a plugin by its KClass.

Link copied to clipboard
Link copied to clipboard
fun removeChildAt(position: Int): Element
Link copied to clipboard
Link copied to clipboard
fun removeChildrenBetweenSpans(startSpanId: String, endSpanId: String): Element
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. This will be ignored if onlyIf is false.

Link copied to clipboard
operator fun set(name: String, value: Boolean): Element
operator fun set(name: String, value: Number): Element
operator fun set(name: String, value: String): Element

operator fun set(name: String, value: JsonPrimitive): Element

Set an attribute of this element. For example a().setAttribute("href", "http://kweb.io") will create an <a> element and set it to <a href="http://kweb.io/">.

operator fun set(name: String, value: 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 set(name: String, value: JsonPrimitive, namespace: String? = null): Element

Set an attribute of this element. For example element["href"] = "http://kweb.io" will create an <a> element and set it to <a href="http://kweb.io/">.

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, value: 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. For example a().setAttribute("href", "http://kweb.io") will create an <a> element and set it to <a href="http://kweb.io/">.

Link copied to clipboard
fun setAttributeRaw(name: String, value: Number): Element
fun setAttributeRaw(name: String, value: String): Element
fun setAttributeRaw(name: String, value: JsonPrimitive): Element
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. This is a wrapper around set.

Link copied to clipboard
fun setClasses(vararg value: String): Element

A convenience function to set the class attribute, this is a wrapper around setAttribute.

Link copied to clipboard
fun spellcheck(spellcheck: Boolean = true): Element

Determines whether this element will be spellchecked.

Link copied to clipboard
fun text(value: String): Element

Set the text of this element to value. Eg. h1().text("Hello World") will create a h1 element and set its text as follows: <h1>Hello World</h1>.

fun text(text: KVal<String>): Element

Set the text of this element to an KVal value. If the text in the KVal changes the text of this element will update automatically.