Performance: Text transform (uppercase, lowercase)
This affects the browser's paint phase by changing how text is displayed without altering the DOM content.
Jump into concepts and practice - no test required
<p class="uppercase">Some Text</p><p>Some Text</p>
<script>
const p = document.querySelector('p');
p.textContent = p.textContent.toUpperCase();
</script>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| JavaScript text content change | 1 text node update | 1 reflow | 1 repaint | [X] Bad |
| Tailwind text-transform utility | 0 DOM changes | 0 reflows | 1 repaint | [OK] Good |
uppercase do to the text?uppercase classuppercase class changes all letters in the text to capital letters.uppercase does.lowercase.capitalize changes first letters to uppercase, uppercase makes all letters capital, and text-lower is not a valid Tailwind class.<p class="uppercase">Hello World</p>
uppercase effectuppercase converts all letters to capital letters.class="lowercasee". What happens?lowercasee is misspelled and not recognized by Tailwind CSS.capitalize classcapitalize class makes the first letter of each word uppercase and the rest lowercase.uppercase makes all letters capital, lowercase makes all letters small, and text-transform is not a valid Tailwind class.