Fix event name check to be more exact (#10274)
Dan Abramov committed
Jul 26, 2017 at 11:56 UTC
5495a7f24aef85ba6937001ce962673ca9f5fde6
1 file changed
+5
-1
src/renderers/dom/shared/hooks/ReactDOMUnknownPropertyHook.js
+5
-1
@@ -50,6 +50,7 @@ if (__DEV__) {
50
onFocusOut: true,
51
};
52
var warnedProperties = {};
53
+ var EVENT_NAME_REGEX = /^on[A-Z]/;
54
55
var validateProperty = function(tagName, name, debugID) {
56
if (
@@ -67,7 +68,10 @@ if (__DEV__) {
68
if (EventPluginRegistry.registrationNameModules.hasOwnProperty(name)) {
69
return true;
70
}
70
- if (EventPluginRegistry.plugins.length === 0 && name.indexOf('on') === 0) {
71
+ if (
72
+ EventPluginRegistry.plugins.length === 0 &&
73
+ EVENT_NAME_REGEX.test(name)
74
+ ) {
75
// If no event plugins have been injected, we might be in a server environment.
76
// Don't check events in this case.
77
return true;