MCPcopy Create free account
hub / github.com/ampproject/amphtml / getPlaceholder

Function getPlaceholder

third_party/inputmask/inputmask.js:1568–1592  ·  view source on GitHub ↗
(pos, test, returnPL)

Source from the content-addressed store, hash-verified

1566 }
1567 }
1568 function getPlaceholder(pos, test, returnPL) {
1569 test = test || getTest(pos).match;
1570 if (test.placeholder !== undefined || returnPL === true) {
1571 return $.isFunction(test.placeholder) ? test.placeholder(opts) : test.placeholder;
1572 } else if (test.fn === null) {
1573 if (pos > -1 && getMaskSet().validPositions[pos] === undefined) {
1574 var tests = getTests(pos), staticAlternations = [], prevTest;
1575 if (tests.length > 1 + (tests[tests.length - 1].match.def === "" ? 1 : 0)) {
1576 for (var i = 0; i < tests.length; i++) {
1577 if (tests[i].match.optionality !== true && tests[i].match.optionalQuantifier !== true && (tests[i].match.fn === null || (prevTest === undefined || tests[i].match.fn.test(prevTest.match.def, getMaskSet(), pos, true, opts) !== false))) {
1578 staticAlternations.push(tests[i]);
1579 if (tests[i].match.fn === null) prevTest = tests[i];
1580 if (staticAlternations.length > 1) {
1581 if (/[0-9a-bA-Z]/.test(staticAlternations[0].match.def)) {
1582 return opts.placeholder.charAt(pos % opts.placeholder.length);
1583 }
1584 }
1585 }
1586 }
1587 }
1588 }
1589 return test.def;
1590 }
1591 return opts.placeholder.charAt(pos % opts.placeholder.length);
1592 }
1593 function HandleNativePlaceholder(npt, value) {
1594 if (ie) {
1595 if (npt.inputmask._valueGet() !== value) {

Callers 9

getMaskTemplateFunction · 0.85
_isValidFunction · 0.85
trackbackPositionsFunction · 0.85
doRadixFocusFunction · 0.85
maskScopeFunction · 0.85
checkValFunction · 0.85
isCompleteFunction · 0.85
renderColorMaskFunction · 0.85

Calls 5

getTestFunction · 0.85
getMaskSetFunction · 0.85
getTestsFunction · 0.85
testMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected