Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Add < /br> to Approved tags?

by ww (Archbishop)
on Jun 20, 2007 at 16:33 UTC ( [id://622310]=monkdiscuss: print w/replies, xml ) Need Help??

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Add < /br> to Approved tags?
by ikegami (Patriarch) on Jun 20, 2007 at 16:45 UTC
    This site use HTML, not XHTML. </br> is not a valid HTML tag.

    To quote from Forcing a line break: the BR element:

    <!ELEMENT BR - O EMPTY -- forced line break --> <!ATTLIST BR %coreattrs; -- id, class, style, title -- >

    Start tag: required, End tag: forbidden

    Note the "End tag: forbidden".

    Even if the </br> tag was allowed, why would you want to include it? You're not allowed to put anything in between the the <br> tag and the </br> tag. It is explicitely forbidden by the "EMPTY" in the quoted text.

    You seem to be confusing BR for DIV.

    <p>foo<br>bar<br>bla</p> # ok <p>foo<br>bar<br>bla # ok, same as previous <p>foo<div>bar</div>bla</p> # ok <p>foo<div>bar</div>bla # ok, same as previous

    Or did you mean <br/>? <br/> is an XHTML shortcut for <br></br>. Neither the shortcut nor the expanded version is valid HTML.

    Sending XHTML when claiming to send HTML is bad. They are not compatible.

    Summary:

    • HTML: <br> (case-insensitive)
    • XHTML: <br></br> (case-sensitive, nothing in between)
    • XHTML shortcut: <br/> (case-sensitive)
    • Perlmonks uses HTML.
    • Sending XHTML as HTML is bad.
    Update: Added Summary.

    Update: I forgot to mention that < XXX> and < /XXX> (for whatever XXX) are invalid HTML and XHTML tags. No space is allowed after the opening <. IE and Firefox interpret the < literally.

Re: Add < /br> to Approved tags?
by grinder (Bishop) on Jun 20, 2007 at 16:48 UTC

    Just one question, why do people use </br> (update: either here or elsewhere), since BR is a element that has no content, as defined by W3C. It can be handily written as <br> or <br />. Allowing <br></br> is just silly, and allowing </ br> would produce non-valid documents.

    Even if other sites think it is legitimate, it does not follow they are correct, or that we should do the same.

    Just because sloppy markup is handled gracefully by browsers, doesn't mean it has to be sanctioned. Don't use it, and then you won't have to patch Perlmonks to allow it :)

    • another intruder with the mooring in the heart of the Perl

      I'm a prior offender: In my case it's due to a "light" understanding of HTML and XML. I was under the (obviously mistaken) impression that empty tags (p, br, &tc.) should have the "closing" flag for completeness. But as you can see, the only completeness is in my ignorance! 8^)

      I don't develop websites, I just generate a few static pages of data. I tend to use boilerplate (e.g., XSLT) and fill in the blanks. So I've seen a good bit of *ML, but can't claim to "know" it. Thus, when I write from scratch, I type what I *think* works, and fix bits until the receiving program quits bitching.

      ...roboticus

      P.S. Now that I've (just) modified my PM settings to be as picky as possible on the HTML, I just had to learn how the consarned p tag works. (As you can see, above I thought that p was one of the empty tags.)
Re: Add < /br> to Approved tags?
by ForgotPasswordAgain (Priest) on Jun 20, 2007 at 16:40 UTC
    I don't think </ br> is even legal HTML,
    is it? (<-- NB: line-breaked, because I used <br />)
      Correct as to the legality, TTBOMK, and I'm failing to find an example, now that I've opened my yap...
      ... err, I mean, "committed my remark to a node." However, I remain persuaded, however wrongly, that I have seen it turn up in nodes here.

      Your post displays with a linebreak after "HTML," but what you used appears to be <br />, which is a different color of cat.

      That said, I believe blessing at least the </br> would be desireable.

        I think the point is -- there is no valid </br> tag for a reason -- it's not valid.

        <br /> is valid XHTML, but perlmonks serves its files as HTML, not XHTML:

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

        And in HTML, there are no closing tags for empty elements (<img>, <br>, <input>, etc.).

Re: Add < /br> to Approved tags?
by ww (Archbishop) on Jun 20, 2007 at 17:04 UTC
    Thanks for the corrective comments above.

    In light of those, would it not be well to automate the correction of the commonly abused tag to enhance the usefulness of Display Settings' error checking?

    That this error and the consequent mis-rendering is commonplace is easily demonstrated with a SuperSearch for "/br>." I count 12 nodes -- excluding those in this thread -- in this month's postings, to date, alone.

      I would have to say that it depends on what you consider 'automating'. There may be worthwhile occurances for it to occur in code. (eg, someone commenting on trying to automate the removal of such tags).

      I have no idea what the janitorial process is here, but if there are common tasks that janitors frequently need to apply, I'm all for giving them access to filters/scripts to clean up common mistakes, provided that there's a human there to apply it, to judge that it really is a mistake. (and not just something blindly done to all posts)

Re: Add < /br> to Approved tags?
by hossman (Prior) on Jun 20, 2007 at 22:24 UTC

    As people have pointed out: Adding "</br>" to a list of approved tags doesn't really make sense ... since it's not a tag, it's a missued closing tag. if you don't open a br, you can't close it.. and the site currently (and correctly) strips out uneeded closing tags -- warning you about them if you are viewing at the necessary HTML error reporting level

    This smells like an X/Y problem discussion...

    If the concern is "unsightly </br> instances showing up in posts", then perhaps the problem is not doing something auto-magically to fix them and guess what the author intended, but instead get the author to do what they ment to do correctly. Perhaps the questions to ask are:

    • Do we really need an "HTML error reporting during Preview" setting? Why not force people to preview at the highest possible error reporting level?
    • Why do we let people post content with malformed (ie: invalid or unclosed) tags? If the preview screen detects and reports on html errors, why not just report those errors in bright RED instead of light grey) and suppress the "create" button so they have to fix the errors and hit preview again?

    Sure, people might *add* errors after previewing a valid post, or while updating an existing doc ... i'm not suggesting we give a 404 if they do click submit after entering malformed HTML ... but why not discourage it as much as (easily) possible?

      Do we really need an "HTML error reporting during Preview" setting? Why not force people to preview at the highest possible error reporting level?

      Um, the point of the "HTML error reporting during Preview" is that you can't set it very low. You only have two choices, "high" and "max". "Max" is only for pedants so there is no point in forcing it upon everyone.

      As I noted a while ago in this thread, I see the problem is that HTML nesting is not "on" for most node previews. So preventing people from prefering the non-pedant error reporting doesn't do any good if the whole feature set isn't even engaged for them.

      It'd also be good for the (higher) "preview" error reporting to apply when your own nodes are rendered.

      - tye        

      I agree--My current weak understanding of HTML is partially due to the fact that browsers are (IMO) too darned laid back about accepting incorrect input. I tend to pay attention to syntax (due to MUCH coding in ASM, C, C++), but only learn it by being hit over the head with error messages. If browsers were more strict, we'd have less crappy websites on the net. (And I'd be responsible for less crappy HTML in my projects!)

      While reading this thread, I noticed that there are some error-checking options in PM, so I've just cranked 'em up to the maximum. Maybe I'll finally learn the nuances of some tags!

      ...roboticus

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: monkdiscuss [id://622310]
Approved by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-29 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found