Move WebIDL methods to traits implemented by JSRef types.

This commit is contained in:
Josh Matthews 2014-04-10 21:29:54 -04:00
parent dfdda0098a
commit 76783b029e
106 changed files with 3644 additions and 1912 deletions

View file

@ -33,11 +33,17 @@ impl DOMParser {
pub fn Constructor(owner: &JSRef<Window>) -> Fallible<Unrooted<DOMParser>> {
Ok(DOMParser::new(owner))
}
}
pub fn ParseFromString(&self,
_s: DOMString,
ty: DOMParserBinding::SupportedType)
-> Fallible<Unrooted<Document>> {
pub trait DOMParserMethods {
fn ParseFromString(&self, _s: DOMString, ty: DOMParserBinding::SupportedType) -> Fallible<Unrooted<Document>>;
}
impl<'a> DOMParserMethods for JSRef<'a, DOMParser> {
fn ParseFromString(&self,
_s: DOMString,
ty: DOMParserBinding::SupportedType)
-> Fallible<Unrooted<Document>> {
let roots = RootCollection::new();
let owner = self.owner.root(&roots);
match ty {