Skip to content

Commit

Permalink
Fix event handling when input name='nodeName'
Browse files Browse the repository at this point in the history
  • Loading branch information
jimfb authored and jim committed Mar 21, 2016
1 parent 40c4635 commit 026b0a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/renderers/dom/client/eventPlugins/ChangeEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ var activeElementValueProp = null;
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
return (
nodeName === 'select' ||
(nodeName === 'input' && elem.type === 'file')
elem instanceof window.HTMLSelectElement ||
(elem instanceof window.HTMLInputElement && elem.type === 'file')
);
}

Expand Down Expand Up @@ -307,7 +306,7 @@ function shouldUseClickEvent(elem) {
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
return (
(elem.nodeName && elem.nodeName.toLowerCase() === 'input') &&
(elem instanceof window.HTMLInputElement) &&
(elem.type === 'checkbox' || elem.type === 'radio')
);
}
Expand Down
7 changes: 3 additions & 4 deletions src/shared/utils/isTextInputElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ var supportedInputTypes = {
};

function isTextInputElement(elem) {
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
return nodeName && (
(nodeName === 'input' && supportedInputTypes[elem.type]) ||
nodeName === 'textarea'
return (
elem instanceof window.HTMLTextAreaElement ||
(elem instanceof window.HTMLInputElement && supportedInputTypes[elem.type])
);
}

Expand Down

0 comments on commit 026b0a0

Please sign in to comment.