I decided not to resurrect #114711: False positive: use <br /> instead of <br>, but I can if someone wants to call this a duplicate.

XHTML is dead, long live HTML(5). I should be allowed to use <br> all I want.

Comments

douggreen’s picture

Status: Active » Postponed (maintainer needs more info)

If Drupal doesn't care about <br>, please link the issue or docs. AFAICT, core now exclusively uses <br/>.

tim.plunkett’s picture

Status: Postponed (maintainer needs more info) » Active

http://dev.w3.org/html5/spec-author-view/syntax.html#syntax-start-tag

Then, if the element is one of the void elements, or if the element is a foreign element, then there may be a single U+002F SOLIDUS character (/). This character has no effect on void elements, but on foreign elements it marks the start tag as self-closing.

br is a void element. It *may* be self-closing, but it doesn't need to be.

http://drupal.org/node/223584 just says "Create good HTML/markup".

Valid markup should not be flagged as bad markup.

tim.plunkett’s picture

Also, grep -nr "<br>" * | wc -l shows 11 uses of br.

douggreen’s picture

Status: Active » Needs work

Look closer, those 11 uses aren't real examples.

$ grep -ir '<br>' {includes,modules}
includes/mail.inc: * <a> <em> <i> <strong> <b> <br> <p> <blockquote> <ul> <ol> <li> <dl> <dt>
modules/aggregator/aggregator.admin.inc:    '#default_value' => variable_get('aggregator_allowed_html_tags', '<a> <b> <br> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>'),
modules/aggregator/aggregator.module:  return filter_xss($value, preg_split('/\s+|<|>/', variable_get('aggregator_allowed_html_tags', '<a> <b> <br> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>'), -1, PREG_SPLIT_NO_EMPTY));
modules/field/modules/text/text.module:  $line_breaks = array('<br />' => 6, '<br>' => 4);
modules/filter/filter.module: * Convert line breaks into <p> and <br> in an intelligent fashion.
modules/filter/filter.test: It is important www.example19.com to *<br/>test different URLs and http://www.example20.com in the same paragraph. *<br>
modules/filter/filter.test:    $f = _filter_htmlcorrector('<hr><br>');
modules/filter/filter.test:    $f = _filter_htmlcorrector('<br></br>');
modules/filter/filter.test:    $f = _filter_htmlcorrector('<p>Line1<br><STRONG>bold stuff</b>');
modules/simpletest/tests/mail.test:      '<br>Drupal<br>Drupal' => "Drupal\nDrupal\n",

I'll need stronger direction from the Drupal community to remove this. Please get a few more people to enter the discussion or if core removes all of the <br/> in Drupal 8.x ???

tim.plunkett’s picture

The point is that <br> is valid. I'm not suggesting that the rule be changed to outlaw <br />. We can do that after #1388926: Remove all references to "self-closing" void elements in core is discussed more.

But in the meantime, the rule should be commented out or removed.

jbrauer’s picture

With that issue closed and http://stackoverflow.com/questions/1946426/html-5-is-it-br-br-or-br as support this should be done IMO.

douggreen’s picture

Status: Needs work » Fixed

I give in, this was only a minor warning, and regardless of it it is dead now or if it will be dead soon, it's meaningless, so fixed in http://drupalcode.org/project/coder.git/commit/bdb009ba2bbb5a15498c8e471....

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.