diff options
author | Sumit <srivassumit@gmail.com> | 2017-03-16 15:46:45 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2017-04-05 01:52:38 -0400 |
commit | 107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee (patch) | |
tree | d65a403aaf42a086904eb86a9e9c22b2a6a5cdf5 /components/script/dom/mutationrecord.rs | |
parent | 5421d833de30e0c963bc6241120263897d4fc68c (diff) | |
download | servo-107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee.tar.gz servo-107ac9ab56c1a4cee3e5f9828f91ab394e3e8eee.zip |
Implement basic interface for MutationObserver and MutationRecord.
Diffstat (limited to 'components/script/dom/mutationrecord.rs')
-rw-r--r-- | components/script/dom/mutationrecord.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/components/script/dom/mutationrecord.rs b/components/script/dom/mutationrecord.rs new file mode 100644 index 00000000000..c39d61ef18a --- /dev/null +++ b/components/script/dom/mutationrecord.rs @@ -0,0 +1,34 @@ +/* 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::Bindings::MutationRecordBinding::MutationRecordBinding::MutationRecordMethods; +use dom::bindings::js::{JS, Root}; +use dom::bindings::reflector::Reflector; +use dom::bindings::str::DOMString; +use dom::node::Node; +use dom_struct::dom_struct; + +#[dom_struct] +pub struct MutationRecord { + reflector_: Reflector, + + //property for record type + record_type: DOMString, + + //property for target node + target: JS<Node>, +} + +impl MutationRecordMethods for MutationRecord { + // https://dom.spec.whatwg.org/#dom-mutationrecord-type + fn Type(&self) -> DOMString { + self.record_type.clone() + } + + // https://dom.spec.whatwg.org/#dom-mutationrecord-target + fn Target(&self) -> Root<Node> { + return Root::from_ref(&*self.target); + } + +} |