Skip to content

Commit

Permalink
Remove unnecessary topLevelTypes indirection
Browse files Browse the repository at this point in the history
topLevelTypes is a key mirror, so dependency and topLevelType are always the same here.
  • Loading branch information
sophiebits committed Jun 16, 2014
1 parent c93583c commit 52127dd
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/browser/ReactBrowserEventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,10 @@ var ReactBrowserEventEmitter = merge(ReactEventEmitterMixin, {
for (var i = 0, l = dependencies.length; i < l; i++) {
var dependency = dependencies[i];
if (!(
isListening.hasOwnProperty(dependency) &&
isListening[dependency]
)) {
var topLevelType = topLevelTypes[dependency];

if (topLevelType === topLevelTypes.topWheel) {
isListening.hasOwnProperty(dependency) &&
isListening[dependency]
)) {
if (dependency === topLevelTypes.topWheel) {
if (isEventSupported('wheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelTypes.topWheel,
Expand All @@ -253,7 +251,7 @@ var ReactBrowserEventEmitter = merge(ReactEventEmitterMixin, {
mountAt
);
}
} else if (topLevelType === topLevelTypes.topScroll) {
} else if (dependency === topLevelTypes.topScroll) {

if (isEventSupported('scroll', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
Expand All @@ -268,8 +266,8 @@ var ReactBrowserEventEmitter = merge(ReactEventEmitterMixin, {
ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
);
}
} else if (topLevelType === topLevelTypes.topFocus ||
topLevelType === topLevelTypes.topBlur) {
} else if (dependency === topLevelTypes.topFocus ||
dependency === topLevelTypes.topBlur) {

if (isEventSupported('focus', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
Expand Down Expand Up @@ -302,7 +300,7 @@ var ReactBrowserEventEmitter = merge(ReactEventEmitterMixin, {
isListening[topLevelTypes.topFocus] = true;
} else if (topEventMapping.hasOwnProperty(dependency)) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
topLevelType,
dependency,
topEventMapping[dependency],
mountAt
);
Expand Down

0 comments on commit 52127dd

Please sign in to comment.