mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Remove DOM mutation listeners
Mutation listeners are known to be slow. Rough benchmarks show text changes are now 50% faster.
This commit is contained in:
committed by
Paul O’Shannessy
parent
ac9f5e9da4
commit
1238f5f23a
@@ -257,11 +257,6 @@ var ReactEventEmitter = merge(ReactEventEmitterMixin, {
|
||||
'selectionchange',
|
||||
mountAt
|
||||
);
|
||||
trapBubbledEvent(
|
||||
topLevelTypes.topDOMCharacterDataModified,
|
||||
'DOMCharacterDataModified',
|
||||
mountAt
|
||||
);
|
||||
|
||||
trapBubbledEvent(
|
||||
topLevelTypes.topCompositionEnd,
|
||||
|
||||
@@ -34,7 +34,6 @@ var topLevelTypes = keyMirror({
|
||||
topCompositionUpdate: null,
|
||||
topCopy: null,
|
||||
topCut: null,
|
||||
topDOMCharacterDataModified: null,
|
||||
topDoubleClick: null,
|
||||
topDrag: null,
|
||||
topDragEnd: null,
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/**
|
||||
* Copyright 2013 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @providesModule SyntheticMutationEvent
|
||||
* @typechecks static-only
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var SyntheticEvent = require('SyntheticEvent');
|
||||
|
||||
/**
|
||||
* @interface MutationEvent
|
||||
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
||||
*/
|
||||
var MutationEventInterface = {
|
||||
relatedNode: null,
|
||||
prevValue: null,
|
||||
newValue: null,
|
||||
attrName: null,
|
||||
attrChange: null
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {object} dispatchConfig Configuration used to dispatch this event.
|
||||
* @param {string} dispatchMarker Marker identifying the event target.
|
||||
* @param {object} nativeEvent Native browser event.
|
||||
* @extends {SyntheticEvent}
|
||||
*/
|
||||
function SyntheticMutationEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
||||
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
||||
}
|
||||
|
||||
SyntheticEvent.augmentClass(SyntheticMutationEvent, MutationEventInterface);
|
||||
|
||||
module.exports = SyntheticMutationEvent;
|
||||
@@ -25,7 +25,6 @@ var SyntheticEvent = require('SyntheticEvent');
|
||||
var SyntheticFocusEvent = require('SyntheticFocusEvent');
|
||||
var SyntheticKeyboardEvent = require('SyntheticKeyboardEvent');
|
||||
var SyntheticMouseEvent = require('SyntheticMouseEvent');
|
||||
var SyntheticMutationEvent = require('SyntheticMutationEvent');
|
||||
var SyntheticTouchEvent = require('SyntheticTouchEvent');
|
||||
var SyntheticUIEvent = require('SyntheticUIEvent');
|
||||
var SyntheticWheelEvent = require('SyntheticWheelEvent');
|
||||
@@ -114,12 +113,6 @@ var eventTypes = {
|
||||
captured: keyOf({onDropCapture: true})
|
||||
}
|
||||
},
|
||||
DOMCharacterDataModified: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: keyOf({onDOMCharacterDataModified: true}),
|
||||
captured: keyOf({onDOMCharacterDataModifiedCapture: true})
|
||||
}
|
||||
},
|
||||
focus: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: keyOf({onFocus: true}),
|
||||
@@ -226,7 +219,6 @@ var topLevelEventsToDispatchConfig = {
|
||||
topCopy: eventTypes.copy,
|
||||
topCut: eventTypes.cut,
|
||||
topDoubleClick: eventTypes.doubleClick,
|
||||
topDOMCharacterDataModified: eventTypes.DOMCharacterDataModified,
|
||||
topDrag: eventTypes.drag,
|
||||
topDragEnd: eventTypes.dragEnd,
|
||||
topDragEnter: eventTypes.dragEnter,
|
||||
@@ -328,9 +320,6 @@ var SimpleEventPlugin = {
|
||||
case topLevelTypes.topMouseUp:
|
||||
EventConstructor = SyntheticMouseEvent;
|
||||
break;
|
||||
case topLevelTypes.topDOMCharacterDataModified:
|
||||
EventConstructor = SyntheticMutationEvent;
|
||||
break;
|
||||
case topLevelTypes.topTouchCancel:
|
||||
case topLevelTypes.topTouchEnd:
|
||||
case topLevelTypes.topTouchMove:
|
||||
|
||||
Reference in New Issue
Block a user