/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::HTMLHeadElementBinding; use dom::bindings::codegen::InheritTypes::HTMLElementCast; use dom::bindings::js::Root; use dom::document::Document; use dom::htmlelement::HTMLElement; use dom::node::Node; use dom::userscripts::load_script; use dom::virtualmethods::VirtualMethods; use util::str::DOMString; #[dom_struct] pub struct HTMLHeadElement { htmlelement: HTMLElement } impl HTMLHeadElement { fn new_inherited(localName: DOMString, prefix: Option, document: &Document) -> HTMLHeadElement { HTMLHeadElement { htmlelement: HTMLElement::new_inherited(localName, prefix, document) } } #[allow(unrooted_must_root)] pub fn new(localName: DOMString, prefix: Option, document: &Document) -> Root { let element = HTMLHeadElement::new_inherited(localName, prefix, document); Node::reflect_node(box element, document, HTMLHeadElementBinding::Wrap) } } impl VirtualMethods for HTMLHeadElement { fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> { let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self); Some(htmlelement as &VirtualMethods) } fn bind_to_tree(&self, _tree_in_doc: bool) { load_script(self); } }