Skip to content

Add `event.relatedTarget` for mouseover and mouseout events #171

Merged
merged 6 commits into from Dec 13, 2012

3 participants

@davidaurelio
uxebu member

This adds a relatedTarget property to mouseover and mouseout event objects. It refers to the bonsai element that has been left or accessed.

@klipstein klipstein commented on the diff Dec 12, 2012
example/library/movies/movie_list.js
@@ -73,6 +73,7 @@ movieList = {
@klipstein
uxebu member
klipstein added a note Dec 12, 2012

why do we have to maintain two movie lists?

@davidaurelio
uxebu member
davidaurelio added a note Dec 12, 2012

let me find out

@davidaurelio
uxebu member
davidaurelio added a note Dec 12, 2012

example/profiling uses movie_list.js, example/library the json file :(

7279042 did not change all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@klipstein klipstein commented on the diff Dec 12, 2012
src/renderer/svg/svg_event_handlers.js
@@ -16,6 +19,40 @@ define([
return tools.mixin({}, e);
}
+ /**
+ * Returns the bonsai id of a DOM node
+ *
+ * @param {Node} node A DOM node
+ * @return {number} The bonsai id of the dom node or -1
+ */
+ function getBonsaiIdOf(node) {
+ var id = node && node.nodeType === ELEMENT_NODE && node.getAttribute('data-bs-id');
@klipstein
uxebu member
klipstein added a note Dec 12, 2012

On https://github.com/uxebu/bonsai/pull/171/files#L5R50 you use bs-data-id and here data-bs-id. Is that correct?

@davidaurelio
uxebu member
davidaurelio added a note Dec 12, 2012

of course not. Good catch. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@klipstein klipstein merged commit cd3f355 into master Dec 13, 2012
@wolframkriesing

thats three tests in one, at least three assumptions/expectations

uxebu member

This once was a test that tested just

expect(event).toEqual({type: eventType, target: dChild, relatedTarget: dParent});

That test always fails, because there is more stuff on the object.
I went the quick route without thinking too much.

I will remove lines 183–184. The interesting and new test is on line 185

uxebu member
uxebu member
@wolframkriesing

why do we do this check? can u create a test, that explains/verifies it?

uxebu member

This would happen if the target is not part of the bonsai movie. I can remove it. Maybe it is not needed.

uxebu member
uxebu member

You’re absolutely right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.