Skip to main content
2 of 3
deleted 4 characters in body
php_nub_qq
  • 715
  • 1
  • 6
  • 18

Do HTML tags make a difference

I made a fairly simple template engine (if I could call it that). Basically my server returns something like

string "This text should be [color:red;font-weight:bold; red and bold]"

Then on the client side I have my parser, for HTML in this case

function parse(str){
    return str.replace(/\[(.+?) (.+?)\]/g,'<span style="$1">$2</span>');
}

I was wondering, however, do HTML tags make a difference? If I were to use font instead of span, would I win/lose anything? Thanks!

P.S.: I am aware that this regex may pick up something that wasn't meant to be parsed, but my application doesn't use these braces in texts it returns, so it is alright.

php_nub_qq
  • 715
  • 1
  • 6
  • 18