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

Function trackbackPositions

third_party/inputmask/inputmask.js:1408–1436  ·  view source on GitHub ↗
(originalPos, newPos, fillOnly)

Source from the content-addressed store, hash-verified

1406 return result;
1407 }
1408 function trackbackPositions(originalPos, newPos, fillOnly) {
1409 var result;
1410 if (originalPos === undefined) {
1411 for (originalPos = newPos - 1; originalPos > 0; originalPos--) {
1412 if (getMaskSet().validPositions[originalPos]) break;
1413 }
1414 }
1415 for (var ps = originalPos; ps < newPos; ps++) {
1416 if (getMaskSet().validPositions[ps] === undefined && !isMask(ps, true)) {
1417 var vp = ps == 0 ? getTest(ps) : getMaskSet().validPositions[ps - 1];
1418 if (vp) {
1419 var tests = getTests(ps).slice();
1420 if (tests[tests.length - 1].match.def === "") tests.pop();
1421 var bestMatch = determineTestTemplate(ps, tests);
1422 bestMatch = $.extend({}, bestMatch, {
1423 input: getPlaceholder(ps, bestMatch.match, true) || bestMatch.match.def
1424 });
1425 bestMatch.generatedInput = true;
1426 revalidateMask(ps, bestMatch, true);
1427 if (fillOnly !== true) {
1428 var cvpInput = getMaskSet().validPositions[newPos].input;
1429 getMaskSet().validPositions[newPos] = undefined;
1430 result = isValid(newPos, cvpInput, true, true);
1431 }
1432 }
1433 }
1434 }
1435 return result;
1436 }
1437 function revalidateMask(pos, validTest, fromSetValid, validatedPos) {
1438 function IsEnclosedStatic(pos, valids, selection) {
1439 var posMatch = valids[pos];

Callers 2

isValidFunction · 0.85
revalidateMaskFunction · 0.85

Calls 9

getMaskSetFunction · 0.85
isMaskFunction · 0.85
getTestFunction · 0.85
getTestsFunction · 0.85
determineTestTemplateFunction · 0.85
getPlaceholderFunction · 0.85
revalidateMaskFunction · 0.85
isValidFunction · 0.85
popMethod · 0.45

Tested by

no test coverage detected