Skip to content

Instantly share code, notes, and snippets.

@hansent
Created February 18, 2016 19:47
Show Gist options
  • Save hansent/551e68d718cc65974ea1 to your computer and use it in GitHub Desktop.
Save hansent/551e68d718cc65974ea1 to your computer and use it in GitHub Desktop.

Uncaught TypeError: elem.nodeName.toLowerCase is not a

As soon as I click on the page, I get the follwing error: Uncaught TypeError: elem.nodeName.toLowerCase is not a function

It fails inside shouldUseChangeEvent, which looks as follows:

function shouldUseChangeEvent(elem) {
  var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
  return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
}

from debugger, I can tell that elem is pointing to the window object, which for some reason has a function called nodeName attached to it?! from the console:

window.nodeName
( elem, name ) {
			return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
		}

stack trace:

  shouldUseChangeEvent @ ChangeEventPlugin.js:50
  ChangeEventPlugin.extractEvents @ ChangeEventPlugin.js:287
  EventPluginHub.extractEvents @ EventPluginHub.js:224
  ReactEventEmitterMixin.handleTopLevel @ ReactEventEmitterMixin.js:33
  handleTopLevelWithoutPath @ ReactEventListener.js:93
  handleTopLevelImpl @ ReactEventListener.js:73
  Mixin.perform @ Transaction.js:136
  ReactDefaultBatchingStrategy.batchedUpdates @ ReactDefaultBatchingStrategy.js:62
  batchedUpdates @ ReactUpdates.js:94
  ReactEventListener.dispatchEvent @ ReactEventListener.js:204
Copy link

ghost commented Aug 26, 2016

I got the same issue, can you tell me how to fix it?

@CezaryDanielNowak
Copy link

For me it was an issue caused by jQuery 2.2.1. Updating to 2.2.4 has fixed problem.
The problem was caused by nodeName property added to window object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment