Warning:
This wiki has been archived and is now read-only.

User:Eoconnor/ISSUE-158

From HTML WG Wiki
Jump to: navigation, search


Preserve the transparent content model of the object element

Summary

The content model of <object> should remain transparent. This helps prevent author error.

This is for ISSUE-158 (object-content-model).

Rationale

The HTML parser auto-closes <dd>, <dt>, <li>, <option>, <optgroup>, <p>, <rp>, and <rt> elements whenever the tree builder is required to generate implied end tags. Authors of HTML documents have long been accustomed to this parser behavior, and most content on the Web depends on it. For instance, consider this example of extremely common markup:

<p>
This is the first paragraph.

<p>
This is the second paragraph.

The second <p> is a sibling of the first <p>, not a descendant of it, because the first <p>'s end tag was auto-generated.

Due to the way <object> and </object> tags are handled in the tree builder's "in body" insertion mode, it's possible to trick the parser into making the second paragraph a descendant of the first by wrapping the second <p> in an <object> element like so:

<p>
This is the first paragraph.

<object>
<p>
This is the second paragraph.
</object>

The Content model of object should be flow content + interactive content Change Proposal requests that we bless such content, for two reasons:

A. Complex children of paragraphs

Some document markup languages (such as DocBook) allow things like tables and lists to be children of paragraphs. Others (such as HTML) do not. There's nothing inherently better or worse about a DocBook-like paragraph model v. an HTML-like paragraph model.

That said, the content model of <p> is a basic design component of HTML that has existed since <p> adopted its current content model in HTML 2.0.[1] Those who would change HTML's paragraph model need to demonstrate significant benefits to the change. After all, there are numerous educational materials, tutorials, and reference guides which would need to be updated.

The Content model of object should be flow content + interactive content Change Proposal does not explicate any particular benefit to this change. It does claim that "authors will add such content in anyway," but this is at best an argument against having any author conformance criteria at all in the spec. This Working Group has repeatedly implicitly confirmed its desire to have author conformance criteria in the spec, in each WG decision that affects the nature and contents of these criteria.

B. Interactive descendants of interactive elements

As explained in the spec's introduction, interactive content should not be nested because the default behavior of such nesting is highly confusing to users. In order to make incuring such a cost worthwhile, there would have to be a significant benefit to such markup that couldn't be achieved in another way. The only benefit explicated in the Content model of object should be flow content + interactive content Change Proposal is that such a change would simplify the content model of <object>. Favoring spec simplicity over user confusion inverts our Priority of Constituencies.

Rich fallback content and content models

The non-<param> contents of <object> is the <object>'s fallback content. This fallback content is supposed to be equivalent to the external resource loaded by the <object>. In this way, users whose User Agent cannot process the external resource (because it doesn't have a particular plugin, or doesn't support a particular media type, or the resource fetch fails, etc., etc.) are able to have an equivalent experience.

If fallback content is equivalent in this way, it should be possible to remove the surrounding <object> (and its <param> children) without changing the meaning or conformance of the document. If we adopt the Content model of object should be flow content + interactive content Change Proposal, this would no longer be the case. We will have broken a basic invariant of fallback content.

Details

No change.

Impact

Positive Effects

  • Conformance checkers will be able to help Web authors avoid several confusing markup patterns, such as nesting interactive elements within each other.

Negative Effects

  • Web authors will not be able to use <object> to work around the content models of other elements.

Conformance Classes Changes

None.

Risks

  • Regardless of the conformance of such content, authors may choose to use <object> in such a manner anyway.

References

Inline.

See also

  • Bug 16381, in which I propose clarifying the contexts in which <embed> and <object> are considered to be phrasing content.

Notes

  1. Before HTML 2.0, <p> was an empty element that signified the break between paragraphs. At that time, of course, <p> couldn't have any child nodes at all.