(element: Element, nodes: Node[], config: SplitTextConfig, collection: HTMLElement[])
| 162 | |
| 163 | // there's some special logic for lines that we need to handle on top of the normal wrapper function |
| 164 | _getLineWrapper = (element: Element, nodes: Node[], config: SplitTextConfig, collection: HTMLElement[]): LineWrapperFunction => { |
| 165 | let lineWrapper: WrapFunction = _getWrapper("line", config, collection), |
| 166 | textAlign: string = window.getComputedStyle(element).textAlign || "left"; |
| 167 | return (startIndex: number, endIndex: number): void => { |
| 168 | let newLine: HTMLElement = lineWrapper(""); |
| 169 | newLine.style.textAlign = textAlign; |
| 170 | element.insertBefore(newLine, nodes[startIndex]); |
| 171 | for (; startIndex < endIndex; startIndex++) { |
| 172 | newLine.appendChild(nodes[startIndex]); |
| 173 | } |
| 174 | newLine.normalize(); |
| 175 | } |
| 176 | }, |
| 177 | |
| 178 | // this is the main recursive function that splits the text into words and characters. We handle line splitting separately. |
| 179 | _splitWordsAndCharsRecursively = (element: Element, config: SplitTextConfig, wordWrapper: WrapFunction, charWrapper: WrapFunction | null, prepForCharsOnly: boolean, deepSlice: boolean, ignore: Element[] | false, charSplitRegEx: RegExp, specialCharsRegEx: RegExp | undefined, isNested: boolean): void => { |
no test coverage detected
searching dependent graphs…