script/dom/html/
htmlhtmlelement.rs1use dom_struct::dom_struct;
6use html5ever::{LocalName, Prefix};
7use js::rust::HandleObject;
8
9use crate::dom::bindings::inheritance::Castable;
10use crate::dom::bindings::root::DomRoot;
11use crate::dom::document::Document;
12use crate::dom::html::htmlelement::HTMLElement;
13use crate::dom::node::Node;
14use crate::script_runtime::CanGc;
15
16#[dom_struct]
17pub(crate) struct HTMLHtmlElement {
18 htmlelement: HTMLElement,
19}
20
21#[allow(non_snake_case)]
22impl HTMLHtmlElement {
23 fn new_inherited(
24 localName: LocalName,
25 prefix: Option<Prefix>,
26 document: &Document,
27 ) -> HTMLHtmlElement {
28 HTMLHtmlElement {
29 htmlelement: HTMLElement::new_inherited(localName, prefix, document),
30 }
31 }
32
33 #[cfg_attr(crown, allow(crown::unrooted_must_root))]
34 pub(crate) fn new(
35 localName: LocalName,
36 prefix: Option<Prefix>,
37 document: &Document,
38 proto: Option<HandleObject>,
39 can_gc: CanGc,
40 ) -> DomRoot<HTMLHtmlElement> {
41 let n = Node::reflect_node_with_proto(
42 Box::new(HTMLHtmlElement::new_inherited(localName, prefix, document)),
43 document,
44 proto,
45 can_gc,
46 );
47
48 n.upcast::<Node>().set_weird_parser_insertion_mode();
49 n
50 }
51}