script/dom/html/
htmlspanelement.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use dom_struct::dom_struct;
6use html5ever::{LocalName, Prefix};
7use js::rust::HandleObject;
8
9use crate::dom::bindings::root::DomRoot;
10use crate::dom::document::Document;
11use crate::dom::html::htmlelement::HTMLElement;
12use crate::dom::node::Node;
13
14#[dom_struct]
15pub(crate) struct HTMLSpanElement {
16    htmlelement: HTMLElement,
17}
18
19impl HTMLSpanElement {
20    fn new_inherited(
21        local_name: LocalName,
22        prefix: Option<Prefix>,
23        document: &Document,
24    ) -> HTMLSpanElement {
25        HTMLSpanElement {
26            htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
27        }
28    }
29
30    pub(crate) fn new(
31        cx: &mut js::context::JSContext,
32        local_name: LocalName,
33        prefix: Option<Prefix>,
34        document: &Document,
35        proto: Option<HandleObject>,
36    ) -> DomRoot<HTMLSpanElement> {
37        Node::reflect_node_with_proto(
38            cx,
39            Box::new(HTMLSpanElement::new_inherited(local_name, prefix, document)),
40            document,
41            proto,
42        )
43    }
44}