Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31795

Re: Replacing javascript line break (\n) with HTML line break (<br/>)

Path csiph.com!aioe.org!news.mixmin.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Replacing javascript line break (\n) with HTML line break (<br/>)
Date Sun, 11 Dec 2016 16:53:43 +0100
Organization PointedEars Software (PES)
Lines 47
Message-ID <2816234.AJdgDx1Vlc@PointedEars.de> (permalink)
References <dc07c4cd-7623-42e4-abe0-972601884ec3@googlegroups.com> <XnsA6D16E788D90Eeejj99@194.109.6.166> <HoZ%z.108664$WF4.105232@fx39.am4> <9051694.nUPlyArG6x@PointedEars.de> <30736b1d-b750-45c2-8df3-a22b2ff7bfd4@googlegroups.com>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace solani.org 1481471624 9152 eJwFwYEBwCAIA7CXBFo2z9EC/59gwkhLfUgmOBwrNBQTp12WNZKd2r819qUP/Gi1FgXHLTw0eBHZ (11 Dec 2016 15:53:44 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Sun, 11 Dec 2016 15:53:44 +0000 (UTC)
User-Agent KNode/4.14.2
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+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Q7V3fMbmg4QNrrBaG
Xref csiph.com comp.lang.javascript:31795

Show key headers only | View raw


rmmjr@rmmillerjr.com wrote:
^^^^^^^^^^^^^^^^^^^^
Please post using your real name.

> <br/> is XHTML syntax and must include the trailing backslash to be valid.

Utter nonsense.
 
> <br> is the HTML5 itteration of a void element, however it does not
> require a trailing backslash for the sake of validity.

“/” is a _slash_, _not_ a *back*slash.  You should learn the basics of a 
field before you attempt to lecture others about it.

The slash, or more precisely, the character sequence “/>”, is required in an 
HTML5 document written in the XHTML syntax:

<https://www.w3.org/TR/2016/REC-html51-20161101/introduction.html#html-vs-xhtml>


It can result in invalid markup in an HTML4 document where, per the HTML 
4.01 Specification, “<…/>” is equivalent to “<…>&gt;”.

For example, “<meta …/>” would be equivalent to “<meta …>&gt;” in HTML4.  
“&gt;” would parse as text content “>”, however text content is not allowed 
on the first nesting level of the HEAD element, where an otherwise valid 
META element were to be found.

And if the result would not be invalid, it could be the unwanted display of 
a “>” character:

Some authors, also through XHTML, have acquired the misconception that 
elements with SGML content model EMPTY would need to be “closed” this way in 
HTML, too.  As a result, some vendors have modified their HTML parsers to 
not implement the HTML4 Specification to the letter (there as well) and to 
simply ignore the slash when in HTML mode; eventually, HTML5, based on 
WHATWG HTML, which is driven by few browser vendors, has standardized this 
behavior.  However, relying on this parsing behavior in documents written
in earlier versions of HTML than 5 is error-prone and should be avoided.

<http://dodabo.de/html+css/tests/shorttag.html>

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Replacing javascript line break (\n) with HTML line break (<br/>) justaguy <lichunshen84@gmail.com> - 2016-11-30 19:15 -0800
  Re: Replacing javascript line break (\n) with HTML line break (<br/>) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-01 10:51 +0100
    Re: Replacing javascript line break (\n) with HTML line break (<br/>) justaguy <lichunshen84@gmail.com> - 2016-12-01 05:55 -0800
      Re: Replacing javascript line break (\n) with HTML line break (<br/>) justaguy <lichunshen84@gmail.com> - 2016-12-01 05:59 -0800
      Re: Replacing javascript line break (\n) with HTML line break (<br/>) "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-12-01 16:41 +0100
    Re: Replacing javascript line break (\n) with HTML line break (<br/>) Cybercode <lambda@dr.com> - 2016-12-01 17:49 +0000
      Re: Replacing javascript line break (\n) with HTML line break (<br/>) justaguy <lichunshen84@gmail.com> - 2016-12-01 13:09 -0800
      Re: Replacing javascript line break (\n) with HTML line break (<br/>) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-01 23:13 +0100
        Re: Replacing javascript line break (\n) with HTML line break (<br/>) rmmjr@rmmillerjr.com - 2016-12-11 07:10 -0800
          Re: Replacing javascript line break (\n) with HTML line break (<br/>) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-12-11 16:53 +0100
        Re: Replacing javascript line break (\n) with HTML line break (<br/>) rmmjr@rmmillerjr.com - 2016-12-11 07:10 -0800

csiph-web