MCPcopy
hub / github.com/angular/components / getSupportedInputTypes

Function getSupportedInputTypes

src/cdk/platform/features/input-types.ts:43–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41
42/** @returns The input types supported by this browser. */
43export function getSupportedInputTypes(): Set<string> {
44 // Result is cached.
45 if (supportedInputTypes) {
46 return supportedInputTypes;
47 }
48
49 // We can't check if an input type is not supported until we're on the browser, so say that
50 // everything is supported when not on the browser. We don't use `Platform` here since it's
51 // just a helper function and can't inject it.
52 if (typeof document !== 'object' || !document) {
53 supportedInputTypes = new Set(candidateInputTypes);
54 return supportedInputTypes;
55 }
56
57 let featureTestInput = document.createElement('input');
58 supportedInputTypes = new Set(
59 candidateInputTypes.filter(value => {
60 featureTestInput.setAttribute('type', value);
61 return featureTestInput.type === value;
62 }),
63 );
64
65 return supportedInputTypes;
66}

Callers 6

PlatformDemoClass · 0.90
typeMethod · 0.90
MatInputClass · 0.90
input.spec.tsFile · 0.90

Calls 1

filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…