Skip to main content
Tweeted twitter.com/#!/StackCodeReview/status/477033529990479872
deleted 8 characters in body; edited title
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

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.

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.

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?

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.

deleted 4 characters in body
Source Link
php_nub_qq
  • 715
  • 1
  • 6
  • 18

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 or lose something/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.

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 or lose something? 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.

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.

Source Link
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 or lose something? 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.