I came across an block of Javascript code to split a paragraph with the dom structure.
The code is as follows:
string.split("<b" + "r>");
I am a little confused as to why do they have to use a PLUS SIGN and split the parameter into lookup strings?
Why not just use
string.split("<br>");
Is there a technique or browser issue involved here?
1 Answer 1
The only thing I can think of is a measure against the <br> tag getting interpreted. In what situation this might happen, I don't know, though. Maybe some very stupid browser or parser screwed up the script and actually rendered the tag.
answered Apr 27, 2010 at 20:36
Pekka
451k150 gold badges990 silver badges1.1k bronze badges
Sign up to request clarification or add additional context in comments.
3 Comments
Mitch Dempsey
Yep, most likely thats the case
Henrik Hansen
I remember reading about script-tags being interpreted in inline JavaScript. The trick was to move the JavaScript to separate files.
David Murdoch
or add comments and CDATA the javascript blocks.
lang-js