0

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?

Cœur
39k25 gold badges207 silver badges282 bronze badges
asked Apr 27, 2010 at 20:33
0

1 Answer 1

6

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
Sign up to request clarification or add additional context in comments.

3 Comments

Yep, most likely thats the case
I remember reading about script-tags being interpreted in inline JavaScript. The trick was to move the JavaScript to separate files.
or add comments and CDATA the javascript blocks.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.