Skip to content

Commit

Permalink
Listen DOM events in each React container
Browse files Browse the repository at this point in the history
Current React implementation is attaching events to `document` level.
This is breaking bubbling DOM behaviour not letting users to play
properly with methods like `stopPropagtion`.

Also attaching events to containers instead of `document` integrates
better with other Javascript frameworks.

With this change we start attaching events at container level.

Fixes:
facebook#2043
facebook#4335
  • Loading branch information
fcsonline committed Jun 20, 2016
1 parent 489caeb commit 8508e1c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/renderers/dom/shared/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,7 @@ function enqueuePutListener(inst, registrationName, listener, transaction) {
);
}
var containerInfo = inst._hostContainerInfo;
var isDocumentFragment = containerInfo._node && containerInfo._node.nodeType === DOC_FRAGMENT_TYPE;
var doc = isDocumentFragment ? containerInfo._node : containerInfo._ownerDocument;
listenTo(registrationName, doc);
listenTo(registrationName, containerInfo._node);
transaction.getReactMountReady().enqueue(putListener, {
inst: inst,
registrationName: registrationName,
Expand Down

0 comments on commit 8508e1c

Please sign in to comment.