Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Can caption end tag be ommitted? #1158

Closed
borela opened this issue Jan 28, 2018 · 4 comments
Closed

Can caption end tag be ommitted? #1158

borela opened this issue Jan 28, 2018 · 4 comments
Assignees
Milestone

Comments

@borela
Copy link

borela commented Jan 28, 2018

A caption element’s end tag may be omitted if the caption element is not immediately followed by a space character or a comment.

Does that mean that:

<caption>This won't need to be closed

<caption> This will because of the space before "this"</caption>

Did I get it right?

@chaals
Copy link
Collaborator

chaals commented Jan 29, 2018

I don't think so.

If you have another element immediately, as in
<caption>This is the caption<tr><th>... you don't need the end tag.

If you have a comment following, like
<caption>This is the caption<!-- you need an end tag>... then you do.

If you have space following the element (not the tag), e.g.
<caption>This is the caption <tr><th>... then it claims you do, but in practice the spaces are part of the caption.

A simple, maybe simplistic test shows that at least in Firefox, Edge, and Opera (blink) there is interoperable behaviour if you do leave out the end tag, with the element being closed when there is another table element and everything up to that point part of the caption.

So I think we could happily remove the restriction and stop requiring a closing tag at all. Note to self, check the parsing to see if it matches that...

@chaals chaals self-assigned this Jan 29, 2018
@chaals chaals added this to the HTML5.3 WD2 milestone Jan 29, 2018
@chaals chaals changed the title Tag omission and spaces Can caption end tag be ommitted? Jan 29, 2018
@borela
Copy link
Author

borela commented Jan 29, 2018

Thank you @chaals :D

@LJWatson
Copy link
Collaborator

Suggest taking a look at #922 on this repo, and the related validator/validator#593 issue.

@chaals
Copy link
Collaborator

chaals commented Feb 10, 2018

@LJWatson saw that. But it turns out implemented reality - and what the parser section seems to suggest should happen - is even simpler than that.

chaals pushed a commit that referenced this issue Feb 10, 2018
Fix #1158

Add an explanatory note about what happens when the end tag is ommitted.
chaals added a commit that referenced this issue Feb 13, 2018
Fix #1158

* Clarify caption end tag can be ommitted
* "drive-by" cleanup for #1201 since I am editing this page
* Add an explanatory note about what happens when the end tag is ommitted.
* Note change
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants