You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: [#1151] Skips SVG elements when in HTMLElement.innerText (#1753)
* fix: [#1151] Skips svg elements when innerText is used
* fix: [#1151] Add newline if it's a block/flex element and there's more content coming after
* chore: [#1151] Improves performance and removes incorrect comment
---------
Co-authored-by: David Ortner <david@ortner.se>
it('Returns rendered text with line breaks between block and flex elements and without hidden elements being rendered if element is connected to the document.',()=>{
281
281
document.body.appendChild(element);
282
282
283
-
element.innerHTML=`<div>The <strong>quick</strong> brown fox</div><script>var key = "value";</script><style>button { background: red; }</style><div>Jumped over the lazy dog</div>`;
283
+
element.innerHTML=`<div>The <strong>quick</strong> brown fox</div><script>var key = "value";</script><style>button { background: red; }</style><div><svg></svg>Jumped over the lazy dog</div>`;
284
284
expect(element.innerText).toBe('The quick brown fox\nJumped over the lazy dog');
285
285
286
286
element.innerHTML=`<div>The <strong>quick</strong> brown fox</div><span style="display: flex">Jumped over the lazy dog</span><div>.</div>`;
element.innerHTML=`<div>The <strong>quick</strong> brown fox</div><span>jumped over the lazy dog</span><style>span { text-transform: capitalize; display: block; }</style>`;
300
300
expect(element.innerText).toBe('The quick brown fox\nJumped Over The Lazy Dog');
301
301
});
302
+
303
+
it("It skips svg elements when innerText is used and add a newline only if there's more content coming after",()=>{
0 commit comments