Legacy String Strategies for Producing HTML

[ad_1]

I am at all times actually excited to see new strategies on JavaScript primitives. These additions are acknowledgement that the language must evolve and that we’re doing thrilling new issues. That being stated, I someway simply found some legacy String strategies that you simply most likely should not use however have existed without end. Let’s have a look!

These legacy string strategies take a primary string of textual content and wrap it in a HTML tag of the identical identify:

"Howdy".large() // "<large>Howdy</large>"
"Howdy".blink() // "<blink>Howdy</blink>"
"Howdy".daring() // "<b>Howdy</b>"
"Howdy".italics() // "<i>Howdy</i>"
"Howdy".hyperlink("https://davidwalsh.identify") // "<a href="https://davidwalsh.identify">Howdy</a>"

Native prototypes do not often take away strategies and for good motive — they’ll break web sites! I am shocked I did not find out about these strategies earlier than right now. It is at all times enjoyable to see relics of the online previous although!

  • I&#8217;m an Impostor

    That is the toughest factor I’ve ever needed to write, a lot much less admit to myself.  I’ve written resignation letters from jobs I’ve beloved, I’ve ended relationships, I’ve failed at a number of duties, and let myself down in my life.  All of these emotions had been very…

  • Detect DOM Node Insertions with JavaScript and CSS Animations
  • Create Keyboard Shortcuts with Mousetrap

    A few of the best components of internet apps are hidden within the little issues.  These “small particulars” can usually add as much as large, large good points.  A kind of small good points could be present in keyboard shortcuts.  Superior internet apps like Gmail and GitHub use a great deal of…

  • CSS Ellipsis Beginning of String

    I used to be extremely comfortable when CSS text-overflow: ellipsis (married with fastened width and overflow: hidden was launched to the CSS spec and browsers; the characteristic allowed us to cease making an attempt to marry JavaScript width calculation with string width calculation and truncation.  CSS ellipsis was additionally very pleasant to…


[ad_2]

Leave a Reply