Hold a Temporary in AncestorIterator

This commit is contained in:
Anthony Ramine 2015-04-05 04:38:25 +02:00
parent 6a6ecb9afa
commit bf7c791e3a
10 changed files with 91 additions and 63 deletions

View file

@ -31,7 +31,8 @@ pub fn dispatch_event<'a, 'b>(target: JSRef<'a, EventTarget>,
let mut chain: RootedVec<JS<EventTarget>> = RootedVec::new();
if let Some(target_node) = NodeCast::to_ref(target) {
for ancestor in target_node.ancestors() {
let ancestor_target: JSRef<EventTarget> = EventTargetCast::from_ref(ancestor);
let ancestor = ancestor.root();
let ancestor_target = EventTargetCast::from_ref(ancestor.r());
chain.push(JS::from_rooted(ancestor_target))
}
}