MCPcopy
hub / github.com/mattboldt/typed.js / typeHtmlChars

Method typeHtmlChars

src/html-parser.js:16–35  ·  view source on GitHub ↗

* Type HTML tags & HTML Characters * @param {string} curString Current string * @param {number} curStrPos Position in current string * @param {Typed} self instance of Typed * @returns {number} a new string position * @private

(curString, curStrPos, self)

Source from the content-addressed store, hash-verified

14 */
15
16 typeHtmlChars(curString, curStrPos, self) {
17 if (self.contentType !== 'html') return curStrPos;
18 const curChar = curString.substring(curStrPos).charAt(0);
19 if (curChar === '<' || curChar === '&') {
20 let endTag = '';
21 if (curChar === '<') {
22 endTag = '>';
23 } else {
24 endTag = ';';
25 }
26 while (curString.substring(curStrPos + 1).charAt(0) !== endTag) {
27 curStrPos++;
28 if (curStrPos + 1 > curString.length) {
29 break;
30 }
31 }
32 curStrPos++;
33 }
34 return curStrPos;
35 }
36
37 /**
38 * Backspace HTML tags and HTML Characters

Callers 1

typewriteMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected