script/dom/
cdatasection.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;
6
7use crate::dom::bindings::root::DomRoot;
8use crate::dom::bindings::str::DOMString;
9use crate::dom::document::Document;
10use crate::dom::node::Node;
11use crate::dom::text::Text;
12use crate::script_runtime::CanGc;
13
14#[dom_struct]
15pub(crate) struct CDATASection {
16    text: Text,
17}
18
19impl CDATASection {
20    fn new_inherited(text: DOMString, document: &Document) -> CDATASection {
21        CDATASection {
22            text: Text::new_inherited(text, document),
23        }
24    }
25
26    pub(crate) fn new(
27        text: DOMString,
28        document: &Document,
29        can_gc: CanGc,
30    ) -> DomRoot<CDATASection> {
31        Node::reflect_node(
32            Box::new(CDATASection::new_inherited(text, document)),
33            document,
34            can_gc,
35        )
36    }
37}