pub struct CSSStyleProperties { /* private fields */ }Expand description
The CSSStyleProperties class.
CSSStyleProperties
Implementations§
Source§impl CSSStyleProperties
impl CSSStyleProperties
Sourcepub fn css_float(&self) -> JsString
pub fn css_float(&self) -> JsString
Getter of the cssFloat attribute.
CSSStyleProperties.cssFloat
Sourcepub fn set_css_float(&mut self, value: &JsString)
pub fn set_css_float(&mut self, value: &JsString)
Setter of the cssFloat attribute.
CSSStyleProperties.cssFloat
Methods from Deref<Target = CSSStyleDeclaration>§
Sourcepub fn css_text(&self) -> JsString
pub fn css_text(&self) -> JsString
Getter of the cssText attribute.
CSSStyleDeclaration.cssText
Sourcepub fn set_css_text(&mut self, value: &JsString)
pub fn set_css_text(&mut self, value: &JsString)
Setter of the cssText attribute.
CSSStyleDeclaration.cssText
Sourcepub fn length(&self) -> u32
pub fn length(&self) -> u32
Getter of the length attribute.
CSSStyleDeclaration.length
Sourcepub fn parent_rule(&self) -> CSSRule
pub fn parent_rule(&self) -> CSSRule
Getter of the parentRule attribute.
CSSStyleDeclaration.parentRule
Sourcepub fn item(&self, index: u32) -> JsString
pub fn item(&self, index: u32) -> JsString
The item method.
CSSStyleDeclaration.item
Sourcepub fn get_property_value(&self, property: &JsString) -> JsString
pub fn get_property_value(&self, property: &JsString) -> JsString
The getPropertyValue method.
CSSStyleDeclaration.getPropertyValue
Sourcepub fn get_property_priority(&self, property: &JsString) -> JsString
pub fn get_property_priority(&self, property: &JsString) -> JsString
The getPropertyPriority method.
CSSStyleDeclaration.getPropertyPriority
Sourcepub fn set_property(&self, property: &JsString, value: &JsString) -> Undefined
pub fn set_property(&self, property: &JsString, value: &JsString) -> Undefined
The setProperty method.
CSSStyleDeclaration.setProperty
Examples found in repository?
4fn main() {
5 let con = Console::get();
6 let document = window().document();
7 let bodies = document.get_elements_by_tag_name(&"body".into());
8 if bodies.length() == 0 {
9 con.log(&["I Ain't got Nobody!".into()]);
10 return;
11 }
12 let body = bodies.item(0);
13 let mut button = document
14 .create_element(&"BUTTON".into())
15 .dyn_into::<HTMLButtonElement>()
16 .unwrap();
17
18 let style = button.style();
19 style.set_property(&"color".into(), &"red".into());
20 style.set_property(&"background-color".into(), &"#aaf".into());
21 style.set_property(&"border".into(), &"solid".into());
22
23 button.set_text_content(&"Click me".into());
24 button.add_event_listener(
25 &"click".into(),
26 &EventListener::from_closure(move |e: Event| {
27 let p = e.dyn_into::<PointerEvent>().unwrap();
28 con.log(&[p.client_x().into()]);
29 Undefined::VALUE
30 }),
31 );
32 body.append_child(button.dyn_ref::<Node>().unwrap());
33}Sourcepub fn set_property_with_priority(
&self,
property: &JsString,
value: &JsString,
priority: &JsString,
) -> Undefined
pub fn set_property_with_priority( &self, property: &JsString, value: &JsString, priority: &JsString, ) -> Undefined
The setProperty method.
CSSStyleDeclaration.setProperty
Sourcepub fn remove_property(&self, property: &JsString) -> JsString
pub fn remove_property(&self, property: &JsString) -> JsString
The removeProperty method.
CSSStyleDeclaration.removeProperty
Methods from Deref<Target = Any>§
Sourcepub fn has_own_property(&self, prop: &str) -> bool
pub fn has_own_property(&self, prop: &str) -> bool
Checks whether a non-inherited property prop exists
Sourcepub fn at<T>(&self, idx: T) -> Val
pub fn at<T>(&self, idx: T) -> Val
Gets the element at index idx. Assumes the underlying js type is indexable
Sourcepub fn to_vec<V>(&self) -> Vec<V>where
V: FromVal,
pub fn to_vec<V>(&self) -> Vec<V>where
V: FromVal,
Converts the underlying js array to a Vec of V
Sourcepub fn call(&self, f: &str, args: &[Val]) -> Val
pub fn call(&self, f: &str, args: &[Val]) -> Val
Calls the method f with args, can return an undefined js value
Sourcepub fn new(&self, args: &[Val]) -> Val
pub fn new(&self, args: &[Val]) -> Val
Calls the object’s constructor with args constructing a new object
Sourcepub fn invoke(&self, args: &[Val]) -> Val
pub fn invoke(&self, args: &[Val]) -> Val
Invokes the function object with args, can return an undefined js value
Sourcepub fn instanceof(&self, v: Val) -> bool
pub fn instanceof(&self, v: Val) -> bool
Checks whether this Val is an instanceof v
pub fn is_number(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn is_string(&self) -> bool
pub fn is_null(&self) -> bool
pub fn is_undefined(&self) -> bool
pub fn is_error(&self) -> bool
pub fn is_function(&self) -> bool
pub fn as_<T>(&self) -> Twhere
T: FromVal,
Trait Implementations§
Source§impl AsMut<Val> for CSSStyleProperties
impl AsMut<Val> for CSSStyleProperties
Source§impl AsRef<Val> for CSSStyleProperties
impl AsRef<Val> for CSSStyleProperties
Source§impl Clone for CSSStyleProperties
impl Clone for CSSStyleProperties
Source§fn clone(&self) -> CSSStyleProperties
fn clone(&self) -> CSSStyleProperties
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CSSStyleProperties
impl Debug for CSSStyleProperties
Source§impl Deref for CSSStyleProperties
impl Deref for CSSStyleProperties
Source§impl DerefMut for CSSStyleProperties
impl DerefMut for CSSStyleProperties
Source§impl DynCast for CSSStyleProperties
impl DynCast for CSSStyleProperties
Source§fn instanceof(val: &Any) -> bool
fn instanceof(val: &Any) -> bool
val instanceof ThisType.Source§fn unchecked_from_val(v: Any) -> Self
fn unchecked_from_val(v: Any) -> Self
Val into Self.Source§fn unchecked_from_val_ref(v: &Any) -> &Self
fn unchecked_from_val_ref(v: &Any) -> &Self
&Val into &Self.Source§fn unchecked_from_val_mut(v: &mut Any) -> &mut Self
fn unchecked_from_val_mut(v: &mut Any) -> &mut Self
&mut Val into &mut Self.fn has_type<T>(&self) -> boolwhere
T: DynCast,
fn dyn_into<T>(self) -> Result<T, Self>where
T: DynCast,
fn dyn_ref<T>(&self) -> Option<&T>where
T: DynCast,
fn dyn_mut<T>(&mut self) -> Option<&mut T>where
T: DynCast,
fn unchecked_into<T>(self) -> Twhere
T: DynCast,
fn unchecked_ref<T>(&self) -> &Twhere
T: DynCast,
fn unchecked_mut<T>(&mut self) -> &mut Twhere
T: DynCast,
fn is_instance_of<T>(&self) -> boolwhere
T: DynCast,
Source§fn is_type_of(val: &Val) -> bool
fn is_type_of(val: &Val) -> bool
instanceof.