Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the jetpack domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/feedavenue.com/public_html/wp-includes/functions.php on line 6114
Legacy String Methods for Generating HTML - Feedavenue
Saturday, December 21, 2024
HomeTechnologySoftwareLegacy String Methods for Generating HTML

Legacy String Methods for Generating HTML

Date:

Related stories

spot_imgspot_img

I’m always really excited to see new methods on JavaScript primitives. These additions are acknowledgement that the language needs to evolve and that we’re doing exciting new things. That being said, I somehow just discovered some legacy String methods that you probably shouldn’t use but have existed forever. Let’s take a look!

These legacy string methods take a basic string of text and wrap it in a HTML tag of the same name:

"Hello".big() // "<big>Hello</big>"
"Hello".blink() // "<blink>Hello</blink>"
"Hello".bold() // "<b>Hello</b>"
"Hello".italics() // "<i>Hello</i>"
"Hello".link("https://davidwalsh.name") // "<a href="https://davidwalsh.name">Hello</a>"

Native prototypes don’t usually remove methods and for good reason — they can break websites! I’m shocked I didn’t know about these methods before today. It’s always fun to see relics of the web past though!

  • Create Spinning Rays with CSS3: Revisited
  • CSS Animations Between Media Queries

    CSS animations are right up there with sliced bread. CSS animations are efficient because they can be hardware accelerated, they require no JavaScript overhead, and they are composed of very little CSS code. Quite often we add CSS transforms to elements via CSS during…



Source link

Latest stories

spot_img
Previous article
Next article