Remove DOM mutation listeners
Mutation listeners are known to be slow. Rough benchmarks show text changes are now 50% faster.
Josh Duck committed
Oct 11, 2013 at 17:30 UTC
1238f5f23a7e4eccc5d1c75d64610438b80640d5
4 files changed
-65
src/core/ReactEventEmitter.js
-5
@@ -257,11 +257,6 @@ var ReactEventEmitter = merge(ReactEventEmitterMixin, {
257
'selectionchange',
258
mountAt
259
);
260
- trapBubbledEvent(
261
- topLevelTypes.topDOMCharacterDataModified,
262
- 'DOMCharacterDataModified',
263
- mountAt
264
- );
260
261
trapBubbledEvent(
262
topLevelTypes.topCompositionEnd,
src/event/EventConstants.js
-1
@@ -34,7 +34,6 @@ var topLevelTypes = keyMirror({
34
topCompositionUpdate: null,
35
topCopy: null,
36
topCut: null,
37
- topDOMCharacterDataModified: null,
37
topDoubleClick: null,
38
topDrag: null,
39
topDragEnd: null,
src/event/synthetic/SyntheticMutationEvent.js
deleted
-48
@@ -1,48 +0,0 @@
1
-/**
2
- * Copyright 2013 Facebook, Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- *
16
- * @providesModule SyntheticMutationEvent
17
- * @typechecks static-only
18
- */
19
-
20
-"use strict";
21
-
22
-var SyntheticEvent = require('SyntheticEvent');
23
-
24
-/**
25
- * @interface MutationEvent
26
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
27
- */
28
-var MutationEventInterface = {
29
- relatedNode: null,
30
- prevValue: null,
31
- newValue: null,
32
- attrName: null,
33
- attrChange: null
34
-};
35
-
36
-/**
37
- * @param {object} dispatchConfig Configuration used to dispatch this event.
38
- * @param {string} dispatchMarker Marker identifying the event target.
39
- * @param {object} nativeEvent Native browser event.
40
- * @extends {SyntheticEvent}
41
- */
42
-function SyntheticMutationEvent(dispatchConfig, dispatchMarker, nativeEvent) {
43
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
44
-}
45
-
46
-SyntheticEvent.augmentClass(SyntheticMutationEvent, MutationEventInterface);
47
-
48
-module.exports = SyntheticMutationEvent;
src/eventPlugins/SimpleEventPlugin.js
-11
@@ -25,7 +25,6 @@ var SyntheticEvent = require('SyntheticEvent');
25
var SyntheticFocusEvent = require('SyntheticFocusEvent');
26
var SyntheticKeyboardEvent = require('SyntheticKeyboardEvent');
27
var SyntheticMouseEvent = require('SyntheticMouseEvent');
28
-var SyntheticMutationEvent = require('SyntheticMutationEvent');
28
var SyntheticTouchEvent = require('SyntheticTouchEvent');
29
var SyntheticUIEvent = require('SyntheticUIEvent');
30
var SyntheticWheelEvent = require('SyntheticWheelEvent');
@@ -114,12 +113,6 @@ var eventTypes = {
113
captured: keyOf({onDropCapture: true})
114
}
115
},
117
- DOMCharacterDataModified: {
118
- phasedRegistrationNames: {
119
- bubbled: keyOf({onDOMCharacterDataModified: true}),
120
- captured: keyOf({onDOMCharacterDataModifiedCapture: true})
121
- }
122
- },
116
focus: {
117
phasedRegistrationNames: {
118
bubbled: keyOf({onFocus: true}),
@@ -226,7 +219,6 @@ var topLevelEventsToDispatchConfig = {
219
topCopy: eventTypes.copy,
220
topCut: eventTypes.cut,
221
topDoubleClick: eventTypes.doubleClick,
229
- topDOMCharacterDataModified: eventTypes.DOMCharacterDataModified,
222
topDrag: eventTypes.drag,
223
topDragEnd: eventTypes.dragEnd,
224
topDragEnter: eventTypes.dragEnter,
@@ -328,9 +320,6 @@ var SimpleEventPlugin = {
320
case topLevelTypes.topMouseUp:
321
EventConstructor = SyntheticMouseEvent;
322
break;
331
- case topLevelTypes.topDOMCharacterDataModified:
332
- EventConstructor = SyntheticMutationEvent;
333
- break;
323
case topLevelTypes.topTouchCancel:
324
case topLevelTypes.topTouchEnd:
325
case topLevelTypes.topTouchMove: