This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22995 - hgroup content model
Summary: hgroup content model
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-17 17:56 UTC by Simon Pieters
Modified: 2013-08-23 21:51 UTC (History)
2 users (show)

See Also:


Attachments

Description Simon Pieters 2013-08-17 17:56:56 UTC
http://html5.org/tools/web-apps-tracker?from=8021&to=8022#diff

[[
+   <dd>One or more <code>h1</code>, <code>h2</code>, <code>h3</code>, <code>h4</code>, <code>h5</code>, <code>h6</code>, and <span>script-supporting</span> elements.</dd>

]]

i'd expect to be able to remove a <script> element and have the document still be valid
Comment 1 Ian 'Hixie' Hickson 2013-08-20 17:56:34 UTC
Why? What's the use case?
Comment 2 Simon Pieters 2013-08-20 18:36:18 UTC
No particular use case, just a mental invariant. Like I expect removing comments to not change the conformance.

One thing I can think of is a mashup of third-party content where you want to strip scripts because they might not make sense in the mashup context, but the mashup should still be conforming if the original content was conforming.
Comment 3 Ian 'Hixie' Hickson 2013-08-22 20:26:40 UTC
The original was only conforming because the script was supposed to be filling in the <hgroup>. If you strip the script, the page is broken. It _should_ therefore be flagged by a validator. This actually is the main use case for putting the <script> inside the <hgroup> that it manages.
Comment 4 Simon Pieters 2013-08-23 08:44:51 UTC
OK. So if this is conforming:

<hgroup><script>document.write('<h1>Hello</h1>');</script></hgroup>

Why should this not be conforming?:

<hgroup id=x></hgroup>
<script>
x.innerHTML = '<h1>Hello</h1>';
</script>

Or on the flip side, why is this conforming?:

<hgroup><script>/* Not filling in the hgroup */</script></hgroup>

Since we don't know what scripts are doing and where they are placed in the DOM doesn't tell much about what the script does, I think the content model here makes little sense. Either we should allow empty hgroup, or we should require one or more headings, in my opinion.

Case study: We allow empty <p> and empty <ol> in case a script fills it in, without requiring a <script> child in the content model.
Comment 5 Ian 'Hixie' Hickson 2013-08-23 21:41:57 UTC
With script, it's mathematically impossible to do a perfect job of statically describing what is ok and what's not. So whatever we do has to be arbitrary. So I went for something that can be used in a useful manner. Obviously it can be abused, there's not much we can do for that.

We allow (sort of) empty <p> because it provides a place to fill in the text, same as we allow an empty <h1> in the <hgroup>.

We allow an empty <ol> because the logical thing to do when filling an <ol> is to generate the <li> along with the rest of the item, to insert the whole thing at once.

<hgroup> is kind of in between. You'll typically not be filling it with script at all; when you do, you'll probably be filling in an explicit <h1> and then adding some <h2>s or whatnot dynamically. Usually if you have an empty one it's gonna be a mistake. But if you have a script in there, you're almost certainly going to have it there for a reason relating to the <hgroup>, so a validator pointing it out isn't useful.

This is just trying to thread the needle to find what's most useful.
Comment 6 Simon Pieters 2013-08-23 21:51:02 UTC
fair enough