-
Notifications
You must be signed in to change notification settings - Fork 1
Children don't bubble parent with functions #146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bubble.js
Outdated
@@ -144,7 +144,9 @@ var bubble = { | |||
// For an event binding on an object, returns the events that should be bubbled. | |||
// For example, `"change" -> ["change"]`. | |||
events: function(map, boundEventName) { | |||
return map.constructor._bubbleRule(boundEventName, map); | |||
if (map && typeof map === 'object') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When should bubbling happen? I think there is probably a better way to do this check. Either using canReflect.isFunctionLike
or canReflect.isMapLike
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should check !canReflect.isFunctionLike(map)
and the one in childrenOf
should use canReflect.isMapLike(child)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phillipskevin I made the requested updates.
canReflect.isMapLike(child)
returns true
with a function, so I just used !canReflect.isFunctionLike
for both .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So does the .childrenOf
need && child.bind
? What is this check for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is the old way to check if the object is a can-map
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this is what I meant to use isMapLike
for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
This is needed to fix canjs/can-list#97
The issue
An error is thrown when function events is bubbled to parent, the check is made by
.bind
can-map/bubble.js
Line 193 in 2f72c0f
for that reason, functions are always bubbled.
The changes
childrenOf
inbubble.js
to bubble events to parent only onObjects
/Map
bubble.js