Problem/Motivation
drupal_pre_render_html_tag() is not specific in allowing which tags can be void (self-closed).
Proposed resolution
Only allow void elements to self close.
Remaining tasks
- Create patch.
User interface changes
None
API changes
None.
Original report:
Just ran into this with a 7.x site:
$build => array(
'#theme' => 'html_tag',
'#tag' => 'section',
'#value' => views_embed_view('articles', 'list'),
);
Unfortunately views_embed_view returned NULL because I forgot that view didn't have a list display. I noticed though that suddenly my page looked all sorts of wacked out and found the issue:
<section />
Um, that should never happen. Started digging and realized the culprit was that it was simply checking if (!isset($element['#value'])) { to determine whether a tag can be self closed. This is un-acceptable. Double checked and the issue still exists in drupal_pre_render_html_tag()
Comments
Comment #1
markhalliwell