aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlelement.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2014-12-12 12:58:42 -0500
committerJosh Matthews <josh@joshmatthews.net>2014-12-18 12:54:02 -0500
commit3cfe8ab53e200eddc8d2bda8ad6c118b7761188c (patch)
treead57c0402ec91ecb98f337872e315fc23997f627 /components/script/dom/htmlelement.rs
parent9d82e06e6479ec963b0c42d2abf6a6c912a0cea2 (diff)
downloadservo-3cfe8ab53e200eddc8d2bda8ad6c118b7761188c.tar.gz
servo-3cfe8ab53e200eddc8d2bda8ad6c118b7761188c.zip
Address review comments.
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)