MCPcopy
hub / github.com/greensock/GSAP / _getLineWrapper

Function _getLineWrapper

src/SplitText.ts:164–176  ·  view source on GitHub ↗
(element: Element, nodes: Node[], config: SplitTextConfig, collection: HTMLElement[])

Source from the content-addressed store, hash-verified

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 => {

Callers 1

splitMethod · 0.70

Calls 1

_getWrapperFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…