aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlelement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r--components/script/dom/htmlelement.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index e37b37b3c55..48acd297574 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -72,13 +72,11 @@ impl<'a> PrivateHTMLElementHelpers for JSRef<'a, HTMLElement> {
impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> {
fn Style(self) -> Temporary<CSSStyleDeclaration> {
- if self.style_decl.get().is_none() {
+ self.style_decl.or_init(|| {
let global = window_from_node(self).root();
- let style_props = CSS2Properties::new(*global, self).root();
- let style_decl: JSRef<CSSStyleDeclaration> = CSSStyleDeclarationCast::from_ref(*style_props);
- self.style_decl.assign(Some(style_decl));
- }
- self.style_decl.get().unwrap()
+ let style_props = CSS2Properties::new(*global, self);
+ CSSStyleDeclarationCast::from_temporary(style_props)
+ })
}
make_getter!(Title)