The library for web and native user interfaces.
Check canUseDOM before calling isEventSupported
Ben Alpert committed
Jun 10, 2013 at 18:27 UTC
932c45a7ab83746f9a6e1a2f21919492b18e7ba0
1 file changed
+7
-3
src/eventPlugins/TextChangeEventPlugin.js
+7
-3
@@ -22,6 +22,7 @@ var AbstractEvent = require('AbstractEvent');
22
var EventConstants = require('EventConstants');
23
var EventPluginHub = require('EventPluginHub');
24
var EventPropagators = require('EventPropagators');
25
+var ExecutionEnvironment = require('ExecutionEnvironment');
26
27
var isEventSupported = require('isEventSupported');
28
var keyOf = require('keyOf');
@@ -39,9 +40,12 @@ var abstractEventTypes = {
40
41
// IE9 claims to support the input event but fails to trigger it when deleting
42
// text, so we ignore its input events
42
-var isInputSupported = isEventSupported('input') && (
43
- !("documentMode" in document) || document.documentMode > 9
44
-);
43
+var isInputSupported;
44
+if (ExecutionEnvironment.canUseDOM) {
45
+ isInputSupported = isEventSupported('input') && (
46
+ !("documentMode" in document) || document.documentMode > 9
47
+ );
48
+}
49
50
var hasInputCapabilities = function(elem) {
51
// The HTML5 spec lists many more types than `text` and `password` on which