script/dom/html/
htmldocument.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 script_bindings::codegen::GenericBindings::DocumentBinding::DocumentMethods;
7use script_bindings::codegen::GenericBindings::HTMLDocumentBinding::HTMLDocumentMethods;
8use script_bindings::root::DomRoot;
9use script_bindings::script_runtime::CanGc;
10use script_bindings::str::DOMString;
11
12use crate::dom::bindings::codegen::Bindings::DocumentBinding::NamedPropertyValue;
13use crate::dom::types::{Document, Location};
14
15/// <https://html.spec.whatwg.org/multipage/#htmldocument>
16#[dom_struct]
17pub(crate) struct HTMLDocument {
18    document: Document,
19}
20
21impl HTMLDocumentMethods<crate::DomTypeHolder> for HTMLDocument {
22    /// <https://html.spec.whatwg.org/multipage/#dom-document-location>
23    fn GetLocation(&self) -> Option<DomRoot<Location>> {
24        self.document.GetLocation()
25    }
26
27    /// <https://html.spec.whatwg.org/multipage/#dom-tree-accessors:supported-property-names>
28    fn SupportedPropertyNames(&self) -> Vec<DOMString> {
29        self.document.SupportedPropertyNames()
30    }
31
32    /// <https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter>
33    fn NamedGetter(&self, name: DOMString, can_gc: CanGc) -> Option<NamedPropertyValue> {
34        self.document.NamedGetter(name, can_gc)
35    }
36}