mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
c5d2fc7127
* Rename lower case isomorphic default exports modules to upper case named exports We're somewhat inconsistent here between e.g. ReactLazy and memo. Let's pick one. This also moves the responder, fundamental, scope creators from shared since they're isomorphic and same as the other creators. * Move some files that are specific to the react-reconciler from shared Individual renderers are allowed to deep require into the reconciler. * Move files specific to react-dom from shared react-interactions is right now dom specific (it wasn't before) so we can type check it together with other dom stuff. Avoids the need for a shared ReactDOMTypes to be checked by RN for example. * Move ReactWorkTags to the reconciler * Move createPortal to export from reconciler Otherwise Noop can't access it since it's not allowed deep requires.
46 lines
979 B
JavaScript
46 lines
979 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
/**
|
|
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
|
|
*/
|
|
const supportedInputTypes: {[key: string]: true | void, ...} = {
|
|
color: true,
|
|
date: true,
|
|
datetime: true,
|
|
'datetime-local': true,
|
|
email: true,
|
|
month: true,
|
|
number: true,
|
|
password: true,
|
|
range: true,
|
|
search: true,
|
|
tel: true,
|
|
text: true,
|
|
time: true,
|
|
url: true,
|
|
week: true,
|
|
};
|
|
|
|
function isTextInputElement(elem: ?HTMLElement): boolean {
|
|
const nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
|
|
|
|
if (nodeName === 'input') {
|
|
return !!supportedInputTypes[((elem: any): HTMLInputElement).type];
|
|
}
|
|
|
|
if (nodeName === 'textarea') {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
export default isTextInputElement;
|