aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/domstringmap.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-10-19 06:32:05 -0600
committerbors-servo <metajack+bors@gmail.com>2015-10-19 06:32:05 -0600
commit1a376aa75d5de8781b17a673850860f8afd2c28f (patch)
tree01650fefa8cb00280835382dfb60c15b57b0dce0 /components/script/dom/domstringmap.rs
parent50ad1b064d6e85e84707d83ca8f4b5b541b6b8da (diff)
parent6dc42dd1d6979cea7059b055de7f0d6f93c14338 (diff)
downloadservo-1a376aa75d5de8781b17a673850860f8afd2c28f.tar.gz
servo-1a376aa75d5de8781b17a673850860f8afd2c28f.zip
Auto merge of #8060 - nox:deref-js, r=Ms2ger
Implement Deref<Target=T> for JS<T> where T: Reflectable We can only borrow `JS<T>` from rooted things, so it's safe to deref it. The only types that provide mutable `JS<T>` things are `MutHeap<JS<T>>` and `MutNullableHeap<JS<T>>`, which don't actually expose that they contain `JS<T>` values. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8060) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/domstringmap.rs')
-rw-r--r--components/script/dom/domstringmap.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs
index cfa5a8e0a1c..95f727c93cb 100644
--- a/components/script/dom/domstringmap.rs
+++ b/components/script/dom/domstringmap.rs
@@ -37,20 +37,17 @@ impl DOMStringMap {
impl DOMStringMapMethods for DOMStringMap {
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-removeitem
fn NamedDeleter(&self, name: DOMString) {
- let element = self.element.root();
- element.r().delete_custom_attr(name)
+ self.element.delete_custom_attr(name)
}
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-setitem
fn NamedSetter(&self, name: DOMString, value: DOMString) -> ErrorResult {
- let element = self.element.root();
- element.r().set_custom_attr(name, value)
+ self.element.set_custom_attr(name, value)
}
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-nameditem
fn NamedGetter(&self, name: DOMString, found: &mut bool) -> DOMString {
- let element = self.element.root();
- match element.r().get_custom_attr(name) {
+ match self.element.get_custom_attr(name) {
Some(value) => {
*found = true;
value.clone()