| 2423 | function renderColorMask(input, caretPos, clear) { |
| 2424 | var maskTemplate = [], isStatic = false, test, testPos, ndxIntlzr, pos = 0; |
| 2425 | function setEntry(entry) { |
| 2426 | if (entry === undefined) entry = ""; |
| 2427 | if (!isStatic && (test.fn === null || testPos.input === undefined)) { |
| 2428 | isStatic = true; |
| 2429 | maskTemplate.push("<span class='im-static'>" + entry); |
| 2430 | } else if (isStatic && (test.fn !== null && testPos.input !== undefined || test.def === "")) { |
| 2431 | isStatic = false; |
| 2432 | var mtl = maskTemplate.length; |
| 2433 | maskTemplate[mtl - 1] = maskTemplate[mtl - 1] + "</span>"; |
| 2434 | maskTemplate.push(entry); |
| 2435 | } else maskTemplate.push(entry); |
| 2436 | } |
| 2437 | function setCaret() { |
| 2438 | if (document.activeElement === input) { |
| 2439 | maskTemplate.splice(caretPos.begin, 0, caretPos.begin === caretPos.end || caretPos.end > getMaskSet().maskLength ? '<mark class="im-caret" style="border-right-width: 1px;border-right-style: solid;">' : '<mark class="im-caret-select">'); |