diff options
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r-- | components/script/dom/element.rs | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 923a587d5bc..143f025fc72 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -242,6 +242,7 @@ pub trait ElementHelpers { fn get_local_name<'a>(&'a self) -> &'a Atom; fn get_namespace<'a>(&'a self) -> &'a Namespace; fn summarize(&self) -> Vec<AttrInfo>; + fn is_void(&self) -> bool; } impl<'a> ElementHelpers for JSRef<'a, Element> { @@ -269,6 +270,20 @@ impl<'a> ElementHelpers for JSRef<'a, Element> { } summarized } + + fn is_void(&self) -> bool { + if self.namespace != namespace::HTML { + return false + } + match self.local_name.as_slice() { + /* List of void elements from + http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#html-fragment-serialization-algorithm */ + "area" | "base" | "basefont" | "bgsound" | "br" | "col" | "embed" | + "frame" | "hr" | "img" | "input" | "keygen" | "link" | "menuitem" | + "meta" | "param" | "source" | "track" | "wbr" => true, + _ => false + } + } } pub trait AttributeHandlers { @@ -489,22 +504,6 @@ impl<'a> AttributeHandlers for JSRef<'a, Element> { } } -impl Element { - pub fn is_void(&self) -> bool { - if self.namespace != namespace::HTML { - return false - } - match self.local_name.as_slice() { - /* List of void elements from - http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#html-fragment-serialization-algorithm */ - "area" | "base" | "basefont" | "bgsound" | "br" | "col" | "embed" | - "frame" | "hr" | "img" | "input" | "keygen" | "link" | "menuitem" | - "meta" | "param" | "source" | "track" | "wbr" => true, - _ => false - } - } -} - impl<'a> ElementMethods for JSRef<'a, Element> { // http://dom.spec.whatwg.org/#dom-element-namespaceuri fn GetNamespaceURI(&self) -> Option<DOMString> { |