Rewrite DocumentType::new to current standards.

This commit is contained in:
Ms2ger 2013-11-02 21:34:44 +01:00
parent 655a2099ef
commit 8c388f6bd4
2 changed files with 28 additions and 13 deletions

View file

@ -2,9 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::DocumentTypeBinding;
use dom::bindings::utils::DOMString;
use dom::document::AbstractDocument;
use dom::node::{ScriptView, Node, DoctypeNodeTypeId};
use dom::node::{AbstractNode, ScriptView, Node, DoctypeNodeTypeId};
/// The `DOCTYPE` tag.
pub struct DocumentType {
@ -16,12 +17,11 @@ pub struct DocumentType {
}
impl DocumentType {
/// Creates a new `DOCTYPE` tag.
pub fn new(name: ~str,
public_id: Option<~str>,
system_id: Option<~str>,
force_quirks: bool,
document: AbstractDocument)
pub fn new_inherited(name: ~str,
public_id: Option<~str>,
system_id: Option<~str>,
force_quirks: bool,
document: AbstractDocument)
-> DocumentType {
DocumentType {
node: Node::new(DoctypeNodeTypeId, document),
@ -32,6 +32,21 @@ impl DocumentType {
}
}
pub fn new(name: ~str,
public_id: Option<~str>,
system_id: Option<~str>,
force_quirks: bool,
document: AbstractDocument) -> AbstractNode<ScriptView> {
let documenttype = DocumentType::new_inherited(name,
public_id,
system_id,
force_quirks,
document);
Node::reflect_node(@mut documenttype, document, DocumentTypeBinding::Wrap)
}
}
impl DocumentType {
pub fn Name(&self) -> DOMString {
Some(self.name.clone())
}