Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81152 views
1
/**
2
* Copyright 2013-2014, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
* @providesModule isTextInputElement
10
*/
11
12
"use strict";
13
14
/**
15
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
16
*/
17
var supportedInputTypes = {
18
'color': true,
19
'date': true,
20
'datetime': true,
21
'datetime-local': true,
22
'email': true,
23
'month': true,
24
'number': true,
25
'password': true,
26
'range': true,
27
'search': true,
28
'tel': true,
29
'text': true,
30
'time': true,
31
'url': true,
32
'week': true
33
};
34
35
function isTextInputElement(elem) {
36
return elem && (
37
(elem.nodeName === 'INPUT' && supportedInputTypes[elem.type]) ||
38
elem.nodeName === 'TEXTAREA'
39
);
40
}
41
42
module.exports = isTextInputElement;
43
44