pub struct CSSStyleSheet(/* private fields */);
Implementations§
Source§impl CSSStyleSheet
impl CSSStyleSheet
pub fn replace_sync(&self, text: &dyn ToJs<JsString>) -> JsNullish
pub fn replace(&self, text: &dyn ToJs<JsString>) -> Promise<CSSStyleSheet>
pub fn remove_rule(&self, index: &dyn ToJs<JsNullable<JsNumber>>) -> JsNullish
pub fn delete_rule(&self, index: &dyn ToJs<JsNumber>) -> JsNullish
pub fn new( browser: &Browser, options: &dyn ToJs<JsNullable<CSSStyleSheetInit>>, ) -> CSSStyleSheet
pub fn insert_rule( &self, rule: &dyn ToJs<JsString>, index: &dyn ToJs<JsNullable<JsNumber>>, ) -> JsNumber
pub fn add_rule( &self, selector: &dyn ToJs<JsNullable<JsString>>, style: &dyn ToJs<JsNullable<JsString>>, index: &dyn ToJs<JsNullable<JsNumber>>, ) -> JsNumber
pub fn get_rules(&self) -> CSSRuleList
pub fn set_rules(&self, value: &CSSRuleList)
pub fn get_owner_rule(&self) -> JsNullable<CSSRule>
pub fn set_owner_rule(&self, value: &dyn ToJs<JsNullable<CSSRule>>)
pub fn get_css_rules(&self) -> CSSRuleList
pub fn set_css_rules(&self, value: &CSSRuleList)
pub fn get_prototype(browser: &Browser) -> CSSStyleSheet
pub fn set_prototype(browser: &Browser, value: &CSSStyleSheet)
Methods from Deref<Target = StyleSheet>§
pub fn get_type(&self) -> JsString
pub fn set_type(&self, value: &dyn ToJs<JsString>)
pub fn get_title(&self) -> JsNullable<JsString>
pub fn set_title(&self, value: &dyn ToJs<JsNullable<JsString>>)
pub fn get_parent_style_sheet(&self) -> JsNullable<CSSStyleSheet>
pub fn set_parent_style_sheet( &self, value: &dyn ToJs<JsNullable<CSSStyleSheet>>, )
pub fn get_owner_node(&self) -> JsValue
pub fn set_owner_node(&self, value: &dyn ToJs<JsValue>)
pub fn get_media(&self) -> MediaList
pub fn set_media(&self, value: &MediaList)
pub fn get_href(&self) -> JsNullable<JsString>
pub fn set_href(&self, value: &dyn ToJs<JsNullable<JsString>>)
pub fn get_disabled(&self) -> JsBoolean
pub fn set_disabled(&self, value: &dyn ToJs<JsBoolean>)
Methods from Deref<Target = JsObject>§
Sourcepub fn js_get_field(&self, property: &dyn UseInJsCode) -> JsValue
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();
}
Sourcepub fn js_set_field(&self, property: &dyn UseInJsCode, value: &dyn UseInJsCode)
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");
}
Sourcepub fn js_call_method<'a>(
&'a self,
method_name: &'a str,
args: impl IntoIterator<Item = &'a dyn UseInJsCode>,
last_arg_variadic: bool,
) -> JsValue
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)
.
Sourcepub fn js_call_self<'a>(
&'a self,
args: impl IntoIterator<Item = &'a dyn UseInJsCode>,
last_arg_variadic: bool,
) -> JsValue
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>§
pub fn browser(&self) -> &Browser
Sourcepub fn retrieve_json(&self) -> RetrieveFuture<'_, Value>
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<CSSStyleSheet> for CSSStyleSheet
impl AsRef<CSSStyleSheet> for CSSStyleSheet
Source§impl AsRef<JsObject> for CSSStyleSheet
impl AsRef<JsObject> for CSSStyleSheet
Source§impl AsRef<JsValue> for CSSStyleSheet
impl AsRef<JsValue> for CSSStyleSheet
Source§impl AsRef<StyleSheet> for CSSStyleSheet
impl AsRef<StyleSheet> for CSSStyleSheet
Source§fn as_ref(&self) -> &StyleSheet
fn as_ref(&self) -> &StyleSheet
Source§impl Clone for CSSStyleSheet
impl Clone for CSSStyleSheet
Source§fn clone(&self) -> CSSStyleSheet
fn clone(&self) -> CSSStyleSheet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more