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

Method replaceText

src/typed.js:444–462  ·  view source on GitHub ↗

* Replaces current text in the HTML element * depending on element type * @param {string} str * @private

(str)

Source from the content-addressed store, hash-verified

442 * @private
443 */
444 replaceText(str) {
445 // let currentElContent = this.getCurrentElContent(this);
446
447 if (this.attr) {
448 this.el.setAttribute(this.attr, str);
449 } else {
450 if (this.isInput) {
451 this.el.value = str;
452 } else if (this.contentType === 'html') {
453 if (this.shouldBackspace) {
454 this.el.innerHTML = str;
455 } else {
456 this.el.innerHTML += str;
457 }
458 } else {
459 this.el.textContent = str;
460 }
461 }
462 }
463
464 /**
465 * If using input elements, bind focus in order to

Callers 4

resetMethod · 0.95
keepTypingMethod · 0.95
backspaceMethod · 0.95
initFadeOutMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected