md2
Version:
Angular2 based Material Design components, directives and services are Accordion, Autocomplete, Chips(Tags), Collapse, Colorpicker, Data Table, Datepicker, Dialog(Modal), Menu, Multiselect, Select, Tabs, Tags(Chips), Toast and Tooltip.
52 lines • 1.69 kB
JavaScript
/** Cached result Set of input types support by the current browser. */
var supportedInputTypes;
/** Types of <input> that *might* be supported. */
var candidateInputTypes = [
// `color` must come first. Chrome 56 shows a warning if we change the type to `color` after
// first changing it to something else:
// The specified value "" does not conform to the required format.
// The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
'color',
'button',
'checkbox',
'date',
'datetime-local',
'email',
'file',
'hidden',
'image',
'month',
'number',
'password',
'radio',
'range',
'reset',
'search',
'submit',
'tel',
'text',
'time',
'url',
'week',
];
/** @returns The input types supported by this browser. */
export function getSupportedInputTypes() {
// Result is cached.
if (supportedInputTypes) {
return supportedInputTypes;
}
// We can't check if an input type is not supported until we're on the browser, so say that
// everything is supported when not on the browser. We don't use `Platform` here since it's
// just a helper function and can't inject it.
if (typeof document !== 'object' || !document) {
supportedInputTypes = new Set(candidateInputTypes);
return supportedInputTypes;
}
var featureTestInput = document.createElement('input');
supportedInputTypes = new Set(candidateInputTypes.filter(function (value) {
featureTestInput.setAttribute('type', value);
return featureTestInput.type === value;
}));
return supportedInputTypes;
}
//# sourceMappingURL=features.js.map