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 26424 - Tag omission rules for rp could break invalid-but-existing content
Summary: Tag omission rules for rp could break invalid-but-existing content
Status: RESOLVED MOVED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: All All
: P0 normal
Target Milestone: ---
Assignee: Robin Berjon
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-24 10:14 UTC by Koji Ishii
Modified: 2016-04-27 22:05 UTC (History)
9 users (show)

See Also:


Attachments

Description Koji Ishii 2014-07-24 10:14:46 UTC
When author puts rp inside rtc, rp auto-closes rtc, and it will produce an unexpected result.

Having rp inside rtc is invalid, so it's not strictly wrong to break. We found one such instance reported at <https://bugzilla.mozilla.org/show_bug.cgi?id=1042885>, but nothing else at this point.

But in this case, unlike rb, rt, or rtc, the benefits of rp to auto-close rtc is little to zero, so I'd prioritize not to break invalid-but-existing content even if its actual usage is low.

One question remains; if we agree to change this behavior, should rp auto-close nothing, or should rp handle rtc as auto-close exception?

I'm leaning to the latter, just because existing implementations used to auto-close rp, rt, and other implied end tags and therefore it can give better backward compatibility, but I'm good with the former if other people prefers.

Example:
<ruby>
  <rbc><rb>壱岐 </rb><rb>ひより</rb></rbc>
  <rtc><rp>(</rp><rt>いき </rt><rt class="ruby_hide">ひより</rt><rp>)</rp></rtc>
  <rtc><rp>(</rp><rt>IKI </rt><rt>Hiyori</rt><rp>)</rp></rtc>
</ruby>
Comment 1 fantasai 2014-07-24 10:58:58 UTC
I think <rp> should not auto-close anything. For complex cases, we don't know what the author will do to make them clear inline.
Comment 2 William Chen 2014-07-25 18:44:01 UTC
I took a quick look at some usages of <rp> on the web and it didn't take long to find a few pages that use <rp> inside of <rt> (it doesn't help that one of these was a ruby tutorial), and also a page that looks like it was written to take advantage of auto-closing because it didn't use close tags.

I didn't investigate to see how different things get rendered if we changed the parsing rules, but I suspect that making <rp> auto-close nothing will probably cause some comparability issues.
Comment 3 Koji Ishii 2014-07-26 12:55:33 UTC
I'm still on the fence.

I think not breaking existing content is quite important. In that sense, rp should auto-close what it did before the spec was changed.

On the other hand, ideally, rp not auto-close anything looks the best spec.

Also, rp not being auto-closed is a big deal and I'm opposed to change that, but rp not auto-closing shouldn't cause too much troubles, or any as far as I can think of.

Can anyone think of a case that rp not auto-closing can cause rendering behavior changes?
Comment 4 William Chen 2014-07-28 18:18:00 UTC
I took a quick look for a style rule that would hide rp and found rules that looked like this in a few places:

ruby > rp {
  display: none;
}
Comment 5 Koji Ishii 2014-07-28 18:53:19 UTC
(In reply to William Chen from comment #2)
> I took a quick look at some usages of <rp> on the web and it didn't take
> long to find a few pages that use <rp> inside of <rt> (it doesn't help that
> one of these was a ruby tutorial), and also a page that looks like it was
> written to take advantage of auto-closing because it didn't use close tags.
> 
> I didn't investigate to see how different things get rendered if we changed
> the parsing rules, but I suspect that making <rp> auto-close nothing will
> probably cause some comparability issues.

Can you paste the links you found?

The spec change caused rp to auto-close rtc, so the this bug is. But even before the new spec, rp used to auto-close rt, so I created a test at http://jsbin.com/bitohe that has:
  <ruby>base<rt><rp>(</rp>ruby<rp>)</rp></rt></ruby>
and it does not render as ruby on Chrome, Safari, nor IE.

After looking at this test results, I started to wonder, maybe this isn't as critical as I originally thought.
Comment 6 Koji Ishii 2014-07-28 19:18:11 UTC
(In reply to Koji Ishii from comment #5)
> After looking at this test results, I started to wonder, maybe this isn't as
> critical as I originally thought.

I mean, changing rp not to auto-close anything will actually fix pages with rp inside rt.

See the test results at http://www.browserstack.com/screenshots/68cc77ec6804d2a6bbc7de29f55f99a14744977d
Browsers that render rp inside rt as ruby are: IE 6/7/8/9
Browsers that do not render rp inside rt as ruby are: IE 10/11, Chrome 35, Safari 7
Firefox not included in the above list because it does not render ruby anyway.

So, the changing will:
* Fix web pages written for IE 6/7/8/9 (real sites wchen found are probably in this category)
* Break web pages that rely on auto-closing behavior of rp for IE 10-, Chrome, Safari

But as long as rp inside rt is already broken, I can't think of single example where rp not auto-closing anything will break.

So, unless I miss something, I think compatibility concern is a needless fear, we can safely fix rp not to auto-close anything.
Comment 7 William Chen 2014-07-28 22:54:10 UTC
(In reply to Koji Ishii from comment #5)
> Can you paste the links you found?

http://reference.sitepoint.com/html/rp
http://www.w3schools.com/TAgs/tag_rp.asp
http://html.eweb-design.com/0406_rub.html
https://github.com/search?q=%3Cruby%3E%3Crt%3E%3Crp%3E&ref=searchresults&type=Code

These are results from a text-based search engine and github code search. I don't have a good tool to search web markup so I don't know how often these things show up in the wild.
Comment 8 Koji Ishii 2014-07-29 00:46:41 UTC
Thanks!

(In reply to William Chen from comment #7)
> (In reply to Koji Ishii from comment #5)
> > Can you paste the links you found?
> 
> http://reference.sitepoint.com/html/rp
> http://www.w3schools.com/TAgs/tag_rp.asp

These two don't render as ruby with IE10-, Chrome, and Safari. So changing rp will fix these pages to IE 9 or before.

> http://html.eweb-design.com/0406_rub.html

This one relies on auto-closing behavior, so the resulting DOM will be changed if we fix this bug. However, it will not make rendering worse at all.

> https://github.com/
> search?q=%3Cruby%3E%3Crt%3E%3Crp%3E&ref=searchresults&type=Code

I didn't know I can do this, thanks, this is quite nice!

I examined first 20; all of them are either:
a) fix broken ruby by the early HTML5 spec to IE9 or earlier (rp inside rt)
b) no changes in DOM (rp has nothing to auto-close)
c) changes DOM but rendering is not affected (rp auto-closes rb).

> These are results from a text-based search engine and github code search. I
> don't have a good tool to search web markup so I don't know how often these
> things show up in the wild.

I understand that. I think this issue is now not about how common it is, but rather if there were any case where changing rp could break. These pages helped me to confirm that my assumption (changing rp auto-closing rule is safe) is still valid.

Note that the site who reported an issue [1] doesn't render as ruby either, and he uses display:table-cell technique to look like ruby. I don't think there are many sites that use the technique, but I might try to find rbc and rtc to double-check later.

[1] http://ikilote.net/fr/Collection/Personnalit%C3%A9.html?id=394
Comment 9 Robin Berjon 2014-08-08 13:42:07 UTC
So, I fixed rp to not autoclose rtc (in c61397b). However I'm confused about the rest of the discussion about having it not autoclose anything?
Comment 10 Koji Ishii 2014-08-08 18:35:43 UTC
(In reply to Robin Berjon from comment #9)
> So, I fixed rp to not autoclose rtc (in c61397b). However I'm confused about
> the rest of the discussion about having it not autoclose anything?

rp to auto-close rtc is a change introduced early this year as you know, and broke at least one existing site though the site is not valid.

rp to auto-close rt is a change introduced years ago, in earlier HTML5 WD, and broke some existing sites. Again, though the sites are not valid, IE6-9 renders such HTML as ruby, and the number of sites the change broke is probably more than the above. Two examples of such sites are:
http://reference.sitepoint.com/html/rp
http://www.w3schools.com/TAgs/tag_rp.asp
but searching in github gives a lot more examples.

So if we change rp not to auto-close rt, it'd be a breaking change against early and current HTML5, but is more compatible with IE6-9. The question here is which is more beneficial for existing contents and for future authors. My opinion is it's better to change not to auto-close rt. It's unlikely to break existing contents, it saves sites that were broken by early/current HTML5 spec, and shouldn't harm future authors almost at all.

Now we started to wonder, should rp auto-close rb or any other elements that have implied end tags.

Benefits for rp to auto-close rb/others:
* can't think much, little to zero

Downside for rp to auto-close rb/others:
* rp behaves differently from any other tags (if we change it not to auto-close rt), so it requires additional "if" statement in the spec and code.
* It will auto-close any new elements we may add in future.

Benefits for rp not to auto-close rb/others:
* Saves sites created for IE6-9.

Downsides for rp not to auto-close rb/others:
* Breaks sites created for HTML5 and relies on rp's auto-closing behavior. Sites that use "rp { display: none; }" are ok, but wchen found some sites use "ruby > rp { display: none; }" so such sites may break if they omit closing tags.

By reviewing this, it looks to me that benefits to auto-close and downsides not to auto-close look much less than benefits not to auto-close and downsides to auto-close.

Does this clarify? Could you clarify what confused you if not?
Comment 11 Zéfling 2014-08-11 11:42:13 UTC
> Note that the site who reported an issue [1] doesn't render as ruby either,
> and he uses display:table-cell technique to look like ruby. I don't think
> there are many sites that use the technique, but I might try to find rbc and
> rtc to double-check later.
> 
> [1] http://ikilote.net/fr/Collection/Personnalit%C3%A9.html?id=394

In fact, I took this technique to my website by taking example on other websites. (Besides, it also works for IE9 and superior, but not IE8 and earlier)
Comment 12 Michael[tm] Smith 2015-06-16 10:09:57 UTC
Agree that it would be good to have a spec change here, and raising priority after reviewing implementer feedback.
Comment 13 Travis Leithead [MSFT] 2016-04-27 22:05:04 UTC
HTML5.1 Bugzilla Bug Triage: Moved to Github issue: https://github.com/w3c/html/issues/288

To file additional issues please use the W3C HTML5 Issue tracker: https://github.com/w3c/html/issues/new Thanks!