From: Thomas 'PointedEars' Lahn on
David Mark wrote:

> laredotornado wrote:
>> $('.replaceLineBreaks').each(function() {
>> console.log("replacing " + $(this).html());
>> $(this).html( $(this).html().replace('/\\n/g', '<BR/>') );
>> });
>>
>> Any ideas how to fix it?
> [...]
> Also, jQuery doesn't work at all in XHTML DOM's, so the BR doesn't need
> a slash (in fact, it will just be thrown out by the browser).

It would be invalid markup anyway. XHTML element type names are
case-sensitive, and it is the `br' element in XHTML.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
From: John G Harris on
On Mon, 22 Feb 2010 at 22:45:15, in comp.lang.javascript, Richard
Cornford wrote:
>laredotornado wrote:
>> Hi,
>>
>> I'm using the JQuery framework but this question is about the
>> string replace method. I'm trying to replace carriage returns
>> "\n" with the "<BR/>" tag.
>
>That is a very strange tag. If it is SGML then the slash at the end
>changes the meaning in an unhelpful way, if it is HTML then the slash
>at the end is an error (that browsers can automatically correct, at the
>cost of a small overhead),
<snip>

Note that the Draft HTML 5 spec. allows /> .

John
--
John Harris
From: Richard Cornford on
On Feb 23, 4:46 pm, John G Harriswrote:
> On Mon, 22 Feb 2010 at 22:45:15, RichardCornford wrote:
>>laredotornado wrote:
<SNIP>
>>> "\n" with the "<BR/>" tag.
>
> >That is a very strange tag. If it is SGML then the slash at the end
> >changes the meaning in an unhelpful way, if it is HTML then the slash
> >at the end is an error (that browsers can automatically correct, at the
> >cost of a small overhead),
>
>   <snip>
>
> Note that the Draft HTML 5 spec. allows /> .

Do you remember an ES4 draft?

Richard.
From: kangax on
On 2/23/10 12:07 PM, Richard Cornford wrote:
> On Feb 23, 4:46 pm, John G Harriswrote:
>> On Mon, 22 Feb 2010 at 22:45:15, RichardCornford wrote:
>>> laredotornado wrote:
> <SNIP>
>>>> "\n" with the"<BR/>" tag.
>>
>>> That is a very strange tag. If it is SGML then the slash at the end
>>> changes the meaning in an unhelpful way, if it is HTML then the slash
>>> at the end is an error (that browsers can automatically correct, at the
>>> cost of a small overhead),
>>
>> <snip>
>>
>> Note that the Draft HTML 5 spec. allows /> .
>
> Do you remember an ES4 draft?

Was ES4 draft ever implemented in implementations as much as HTML5 draft
is at the moment?

<http://wiki.whatwg.org/wiki/Implementations_in_Web_browsers>

--
kangax