diff options
author | Josh Matthews <josh@joshmatthews.net> | 2014-12-12 12:58:42 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2014-12-18 12:54:02 -0500 |
commit | 3cfe8ab53e200eddc8d2bda8ad6c118b7761188c (patch) | |
tree | ad57c0402ec91ecb98f337872e315fc23997f627 /components/script/dom/htmlelement.rs | |
parent | 9d82e06e6479ec963b0c42d2abf6a6c912a0cea2 (diff) | |
download | servo-3cfe8ab53e200eddc8d2bda8ad6c118b7761188c.tar.gz servo-3cfe8ab53e200eddc8d2bda8ad6c118b7761188c.zip |
Address review comments.
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r-- | components/script/dom/htmlelement.rs | 10 |
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) |