diff options
author | Sankha Narayan Guria <sankha93@gmail.com> | 2014-02-27 03:31:05 +0530 |
---|---|---|
committer | Sankha Narayan Guria <sankha93@gmail.com> | 2014-02-27 03:31:05 +0530 |
commit | 1e9fec9172364346937f375e315e1ce745662611 (patch) | |
tree | a55173568e6dd6a8b4cb4dfcc42ed81204d49874 /src/components/script/dom/htmldocument.rs | |
parent | 47e6e6ec8f2dfbd56e50f9f2ec2762b85087d948 (diff) | |
parent | da16e54243e256dee927f720ce6b9903b62ec14e (diff) | |
download | servo-1e9fec9172364346937f375e315e1ce745662611.tar.gz servo-1e9fec9172364346937f375e315e1ce745662611.zip |
Merge master into this branch
Diffstat (limited to 'src/components/script/dom/htmldocument.rs')
-rw-r--r-- | src/components/script/dom/htmldocument.rs | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/src/components/script/dom/htmldocument.rs b/src/components/script/dom/htmldocument.rs deleted file mode 100644 index 8297fd3e90c..00000000000 --- a/src/components/script/dom/htmldocument.rs +++ /dev/null @@ -1,86 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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::HTMLDocumentBinding; -use dom::bindings::utils::{Reflectable, Reflector, Traceable}; -use dom::document::{AbstractDocument, Document, HTML}; -use dom::htmlcollection::HTMLCollection; -use dom::window::Window; -use servo_util::namespace::Null; - -use extra::url::Url; -use js::jsapi::JSTracer; - -pub struct HTMLDocument { - parent: Document -} - -impl HTMLDocument { - pub fn new_inherited(window: @mut Window, url: Option<Url>) -> HTMLDocument { - HTMLDocument { - parent: Document::new_inherited(window, url, HTML, None) - } - } - - pub fn new(window: @mut Window, url: Option<Url>) -> AbstractDocument { - let document = HTMLDocument::new_inherited(window, url); - Document::reflect_document(@mut document, window, HTMLDocumentBinding::Wrap) - } -} - -impl HTMLDocument { - pub fn Images(&self) -> @mut HTMLCollection { - self.parent.createHTMLCollection(|elem| "img" == elem.tag_name) - } - - pub fn Embeds(&self) -> @mut HTMLCollection { - self.parent.createHTMLCollection(|elem| "embed" == elem.tag_name) - } - - pub fn Plugins(&self) -> @mut HTMLCollection { - self.Embeds() - } - - pub fn Links(&self) -> @mut HTMLCollection { - self.parent.createHTMLCollection(|elem| { - ("a" == elem.tag_name || "area" == elem.tag_name) && - elem.get_attribute(Null, "href").is_some() - }) - } - - pub fn Forms(&self) -> @mut HTMLCollection { - self.parent.createHTMLCollection(|elem| "form" == elem.tag_name) - } - - pub fn Scripts(&self) -> @mut HTMLCollection { - self.parent.createHTMLCollection(|elem| "script" == elem.tag_name) - } - - pub fn Anchors(&self) -> @mut HTMLCollection { - self.parent.createHTMLCollection(|elem| { - "a" == elem.tag_name && elem.get_attribute(Null, "name").is_some() - }) - } - - pub fn Applets(&self) -> @mut HTMLCollection { - // FIXME: This should be return OBJECT elements containing applets. - self.parent.createHTMLCollection(|elem| "applet" == elem.tag_name) - } -} - -impl Reflectable for HTMLDocument { - fn reflector<'a>(&'a self) -> &'a Reflector { - self.parent.reflector() - } - - fn mut_reflector<'a>(&'a mut self) -> &'a mut Reflector { - self.parent.mut_reflector() - } -} - -impl Traceable for HTMLDocument { - fn trace(&self, tracer: *mut JSTracer) { - self.parent.trace(tracer); - } -} |