script/dom/html/
htmlulistelement.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::codegen::Bindings::HTMLUListElementBinding::HTMLUListElementMethods;
10use crate::dom::bindings::root::DomRoot;
11use crate::dom::bindings::str::DOMString;
12use crate::dom::document::Document;
13use crate::dom::html::htmlelement::HTMLElement;
14use crate::dom::node::Node;
15
16#[dom_struct]
17pub(crate) struct HTMLUListElement {
18    htmlelement: HTMLElement,
19}
20
21impl HTMLUListElement {
22    fn new_inherited(
23        local_name: LocalName,
24        prefix: Option<Prefix>,
25        document: &Document,
26    ) -> HTMLUListElement {
27        HTMLUListElement {
28            htmlelement: HTMLElement::new_inherited(local_name, 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<HTMLUListElement> {
39        Node::reflect_node_with_proto(
40            cx,
41            Box::new(HTMLUListElement::new_inherited(
42                local_name, prefix, document,
43            )),
44            document,
45            proto,
46        )
47    }
48}
49
50impl HTMLUListElementMethods<crate::DomTypeHolder> for HTMLUListElement {
51    // https://html.spec.whatwg.org/multipage/#dom-ul-compact
52    make_bool_getter!(Compact, "compact");
53
54    // https://html.spec.whatwg.org/multipage/#dom-ul-compact
55    make_bool_setter!(SetCompact, "compact");
56
57    // https://html.spec.whatwg.org/multipage/#dom-ul-type
58    make_getter!(Type, "type");
59
60    // https://html.spec.whatwg.org/multipage/#dom-ul-type
61    make_setter!(SetType, "type");
62}