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;
14
15#[dom_struct]
16pub(crate) struct HTMLHtmlElement {
17 htmlelement: HTMLElement,
18}
19
20#[expect(non_snake_case)]
21impl HTMLHtmlElement {
22 fn new_inherited(
23 localName: LocalName,
24 prefix: Option<Prefix>,
25 document: &Document,
26 ) -> HTMLHtmlElement {
27 HTMLHtmlElement {
28 htmlelement: HTMLElement::new_inherited(localName, prefix, document),
29 }
30 }
31
32 pub(crate) fn new(
33 cx: &mut js::context::JSContext,
34 local_name: LocalName,
35 prefix: Option<Prefix>,
36 document: &Document,
37 proto: Option<HandleObject>,
38 ) -> DomRoot<HTMLHtmlElement> {
39 let n = Node::reflect_node_with_proto(
40 cx,
41 Box::new(HTMLHtmlElement::new_inherited(local_name, prefix, document)),
42 document,
43 proto,
44 );
45
46 n.upcast::<Node>().set_weird_parser_insertion_mode();
47 n
48 }
49}