Struct ElementInternals

Source
pub struct ElementInternals(/* private fields */);

Implementations§

Source§

impl ElementInternals

Source

pub fn report_validity(&self) -> JsBoolean

Source

pub fn check_validity(&self) -> JsBoolean

Source

pub fn new(browser: &Browser) -> ElementInternals

Source

pub fn set_form_value_method( &self, value: &dyn ToJs<JsValue>, state: &dyn ToJs<JsNullable<JsValue>>, ) -> JsNullish

Source

pub fn set_validity_method( &self, flags: &dyn ToJs<JsNullable<ValidityStateFlags>>, message: &dyn ToJs<JsNullable<JsString>>, anchor: &dyn ToJs<JsNullable<HTMLElement>>, ) -> JsNullish

Source

pub fn get_role(&self) -> JsNullable<JsString>

Source

pub fn set_role(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_value_text(&self) -> JsNullable<JsString>

Source

pub fn set_aria_value_text(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_value_now(&self) -> JsNullable<JsString>

Source

pub fn set_aria_value_now(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_value_min(&self) -> JsNullable<JsString>

Source

pub fn set_aria_value_min(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_value_max(&self) -> JsNullable<JsString>

Source

pub fn set_aria_value_max(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_sort(&self) -> JsNullable<JsString>

Source

pub fn set_aria_sort(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_set_size(&self) -> JsNullable<JsString>

Source

pub fn set_aria_set_size(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_selected(&self) -> JsNullable<JsString>

Source

pub fn set_aria_selected(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_row_span(&self) -> JsNullable<JsString>

Source

pub fn set_aria_row_span(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_row_index(&self) -> JsNullable<JsString>

Source

pub fn set_aria_row_index(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_row_count(&self) -> JsNullable<JsString>

Source

pub fn set_aria_row_count(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_role_description(&self) -> JsNullable<JsString>

Source

pub fn set_aria_role_description(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_required(&self) -> JsNullable<JsString>

Source

pub fn set_aria_required(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_read_only(&self) -> JsNullable<JsString>

Source

pub fn set_aria_read_only(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_pressed(&self) -> JsNullable<JsString>

Source

pub fn set_aria_pressed(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_pos_in_set(&self) -> JsNullable<JsString>

Source

pub fn set_aria_pos_in_set(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_placeholder(&self) -> JsNullable<JsString>

Source

pub fn set_aria_placeholder(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_orientation(&self) -> JsNullable<JsString>

Source

pub fn set_aria_orientation(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_multi_selectable(&self) -> JsNullable<JsString>

Source

pub fn set_aria_multi_selectable(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_multi_line(&self) -> JsNullable<JsString>

Source

pub fn set_aria_multi_line(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_modal(&self) -> JsNullable<JsString>

Source

pub fn set_aria_modal(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_live(&self) -> JsNullable<JsString>

Source

pub fn set_aria_live(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_level(&self) -> JsNullable<JsString>

Source

pub fn set_aria_level(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_label(&self) -> JsNullable<JsString>

Source

pub fn set_aria_label(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_key_shortcuts(&self) -> JsNullable<JsString>

Source

pub fn set_aria_key_shortcuts(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_invalid(&self) -> JsNullable<JsString>

Source

pub fn set_aria_invalid(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_hidden(&self) -> JsNullable<JsString>

Source

pub fn set_aria_hidden(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_has_popup(&self) -> JsNullable<JsString>

Source

pub fn set_aria_has_popup(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_expanded(&self) -> JsNullable<JsString>

Source

pub fn set_aria_expanded(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_disabled(&self) -> JsNullable<JsString>

Source

pub fn set_aria_disabled(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_current(&self) -> JsNullable<JsString>

Source

pub fn set_aria_current(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_col_span(&self) -> JsNullable<JsString>

Source

pub fn set_aria_col_span(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_col_index(&self) -> JsNullable<JsString>

Source

pub fn set_aria_col_index(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_col_count(&self) -> JsNullable<JsString>

Source

pub fn set_aria_col_count(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_checked(&self) -> JsNullable<JsString>

Source

pub fn set_aria_checked(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_busy(&self) -> JsNullable<JsString>

Source

pub fn set_aria_busy(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_auto_complete(&self) -> JsNullable<JsString>

Source

pub fn set_aria_auto_complete(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_aria_atomic(&self) -> JsNullable<JsString>

Source

pub fn set_aria_atomic(&self, value: &dyn ToJs<JsNullable<JsString>>)

Source

pub fn get_will_validate(&self) -> JsBoolean

Source

pub fn set_will_validate(&self, value: &dyn ToJs<JsBoolean>)

Source

pub fn get_validity(&self) -> ValidityState

Source

pub fn set_validity(&self, value: &ValidityState)

Source

pub fn get_validation_message(&self) -> JsString

Source

pub fn set_validation_message(&self, value: &dyn ToJs<JsString>)

Source

pub fn get_shadow_root(&self) -> JsNullable<ShadowRoot>

Source

pub fn set_shadow_root(&self, value: &dyn ToJs<JsNullable<ShadowRoot>>)

Source

pub fn get_labels(&self) -> NodeList

Source

pub fn set_labels(&self, value: &NodeList)

Source

pub fn get_form(&self) -> JsNullable<HTMLFormElement>

Source

pub fn set_form(&self, value: &dyn ToJs<JsNullable<HTMLFormElement>>)

Source

pub fn get_prototype(browser: &Browser) -> ElementInternals

Source

pub fn set_prototype(browser: &Browser, value: &ElementInternals)

Methods from Deref<Target = JsObject>§

Source

pub fn js_get_field(&self, property: &dyn UseInJsCode) -> JsValue

Get a field value of in this object.

WSDOM provides built-in getters so you should use that instead when possible.

Use js_get_field only when needed

fn example(browser: Browser) {
    // you can get `window["location"]["href"]` like this
    let href: JsValue = wsdom::dom::location(&browser).js_get_field(&"href");

    // but you should use built-in getters instead
    let href: JsString = wsdom::dom::location(&browser).get_href();
}
Source

pub fn js_set_field(&self, property: &dyn UseInJsCode, value: &dyn UseInJsCode)

Set a field value of in this object.

WSDOM provides built-in setters so you should use that instead when possible.

Use js_set_field only when needed

fn example(browser: Browser) {
    // you can set `window["location"]["href"]` like this
    wsdom::dom::location(&browser).js_set_field(&"href", &"https://example.com/");

    // but you should use built-in setters instead
    wsdom::dom::location(&browser).set_href(&"https://example.com");
}
Source

pub fn js_call_method<'a>( &'a self, method_name: &'a str, args: impl IntoIterator<Item = &'a dyn UseInJsCode>, last_arg_variadic: bool, ) -> JsValue

Call a method on this object.

Most types in WSDOM already come with safe Rust wrappers for their methods, so you should use those instead.

fn example(browser: &Browser) {
    let console = wsdom::dom::console(browser);
    // you can call console.log like this
    console.js_call_method("log", [&"hello" as &_], false);
     
    // but the better way is to use
    wsdom::dom::console(&browser).log(&[&"Hello" as &_]);
}

Be aware that the first argument (method_name) is NOT escaped.

Set last_arg_variadic to true if you want to “spread” the last argument as obj.method(arg1, arg2, ...arg3).

Source

pub fn js_call_self<'a>( &'a self, args: impl IntoIterator<Item = &'a dyn UseInJsCode>, last_arg_variadic: bool, ) -> JsValue

Call this object: obj().

Most types in WSDOM already come with safe Rust wrappers for their methods, so you should use those instead.

Methods from Deref<Target = JsValue>§

Source

pub fn browser(&self) -> &Browser

Source

pub fn retrieve_json(&self) -> RetrieveFuture<'_, Value>

Retrive this value from the JS side to the Rust side. Returns Future whose output is a serde_json::Value.

§use wsdom::dom::Browser
§use wsdom::dom::HTMLInputElement;

async fn example(input: &HTMLInputElement) { let _val = input.get_value().retrieve_json().await; }

Trait Implementations§

Source§

impl AsRef<ARIAMixin> for ElementInternals

Source§

fn as_ref(&self) -> &ARIAMixin

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<ElementInternals> for ElementInternals

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<JsObject> for ElementInternals

Source§

fn as_ref(&self) -> &JsObject

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<JsValue> for ElementInternals

Source§

fn as_ref(&self) -> &JsValue

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for ElementInternals

Source§

fn clone(&self) -> ElementInternals

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Deref for ElementInternals

Source§

type Target = JsObject

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Into<ARIAMixin> for ElementInternals

Source§

fn into(self) -> ARIAMixin

Converts this type into the (usually inferred) input type.
Source§

impl Into<JsObject> for ElementInternals

Source§

fn into(self) -> JsObject

Converts this type into the (usually inferred) input type.
Source§

impl Into<JsValue> for ElementInternals

Source§

fn into(self) -> JsValue

Converts this type into the (usually inferred) input type.
Source§

impl JsCast for ElementInternals

Source§

fn unchecked_from_js(val: JsValue) -> Self

Source§

fn unchecked_from_js_ref(val: &JsValue) -> &Self

Source§

fn unchecked_into<T>(self) -> T
where T: JsCast,

Source§

fn unchecked_ref<T>(&self) -> &T
where T: JsCast,

Source§

impl RefCast for ElementInternals

Source§

type From = JsValue

Source§

fn ref_cast(_from: &Self::From) -> &Self

Source§

fn ref_cast_mut(_from: &mut Self::From) -> &mut Self

Source§

impl UseInJsCode for ElementInternals

Source§

fn serialize_to(&self, buf: &mut Formatter<'_>) -> Result

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ToJs<T> for T
where T: UseInJsCode + ?Sized,