Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default styling of <rp> #2134

Open
zcorpan opened this issue Dec 5, 2016 · 11 comments
Open

Default styling of <rp> #2134

zcorpan opened this issue Dec 5, 2016 · 11 comments
Labels
compat Standard is not web compatible or proprietary feature needs standardizing interop Implementations are not interoperable with each other topic: rendering

Comments

@zcorpan
Copy link
Member

zcorpan commented Dec 5, 2016

It seems we don't have interop on the default style of rp.

Tests:
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4711
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4714

'display' is...

Test case Edge 13 Blink, WebKit Gecko IE 8..9 IE 10..11
<p><ruby><rp> none none none none none
<p><ruby><rtc><rp> none inline none none none
<p><ruby><span><rp> none inline none none none
<p><rp> inline inline none inline none
<p><ruby><rp style="display: inline-block"> inline-block inline-block inline-block none none

That is, we have these UA stylesheets:

Edge 13
ruby rp { display: none; }
Blink, WebKit
ruby > rp { display: none; }
Gecko
rp { display: none; }
IE 8..9
ruby rp { display: none !important; }
IE 10..11
rp { display: none !important; }

Currently the spec says Gecko, IE 10..11 are correct.

In httparchive, looking for pages that have <rp> but no <ruby>, I found a single page that is "broken" in Gecko but not in the others:

http://www.kerala.com/ has

<script type="text/javascript">  
    Cufon.replace('rp');
</script>
...
                                      <div class="hrh_text">Rooms from</div><div class="hrh_pric">
                                      <strong><rp>`</rp> 
                                      1495/-</strong></div></div>

(The cufon thing inserts a canvas into the rp to render some glyph.)

The Blink and WebKit default style seems incompatible with rtc (#121). Gecko is simplest, but it is the only engine now to hide rp outside ruby, and it breaks at least the page above. Should we switch to the behavior of Edge 13?

cc @upsuper @yosinch @kojiishi @rniwa

@zcorpan zcorpan added compat Standard is not web compatible or proprietary feature needs standardizing topic: rendering labels Dec 5, 2016
@zcorpan
Copy link
Member Author

zcorpan commented Dec 5, 2016

From the spec:

An rp element that is a child of a ruby element represents nothing. An rp element whose parent element is not a ruby element represents its children.

In the absence of style-layer rules to the contrary (e.g. author style sheets), user agents are expected to render an element so that it conveys to the user the meaning that the element represents, as described by this specification.

[hidden], area, base, basefont, datalist, head, link, menu[type=context i], meta,
noembed, noframes, param, rp, script, source, style, template, track, title {
display: none;
}

This is not internally consistent, so that should be fixed (regardless of which UA style we decide on).

@kojiishi
Copy link

kojiishi commented Dec 6, 2016

I'm fine with Edge or Gecko. Thank you for your investigations.

@upsuper
Copy link
Member

upsuper commented Dec 6, 2016

I'd prefer Gecko's current behavior, but I don't have strong opinion against Edge's, so if the webcompat impact is reasonable, I'm fine with Edge's behavior.

I have one concern that, per CSS Ruby spec, <rb>, <rt>, and <rtc> can appear outside <ruby>, and anonymous boxes would be built up automatically. In that case, only hiding <rp> in <ruby> may lead to some <rp>s stop working while they are expected to. That kind of automatic box-building is only supported in Firefox, so it is probably not a serious issue. <rt> outside <ruby> doesn't work in other browsers at all currently.

Another edge case would be using inline-blocks inside ruby, then its descendant <rp>s would suddently disappear with Edge's behavior. But that doesn't seem to be a sensible usecase.

@kojiishi
Copy link

kojiishi commented Dec 6, 2016

The anonymous box case sounds reasonable. @zcorpan do we know someone to ask the opinion from Edge on this topic?

@zcorpan
Copy link
Member Author

zcorpan commented Dec 6, 2016

Using rp (or rt etc) outside ruby is invalid HTML. There is no use case for it.

Using the CSS ruby model with anonymous boxes is fine, but that has nothing to do with using the rp element not in a ruby element. span or something should be used.

While it is reasonable to think that it is expected that an rp not in ruby should still be hidden, I have not found any real-world page where that expectation holds. I have only found one page that is affected, and it had the opposite expectation.

Another edge case would be using inline-blocks inside ruby, then its descendant <rp>s would suddently disappear with Edge's behavior. But that doesn't seem to be a sensible usecase.

If the author explicitly sets display on rp, then that would be honored. Testing with http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4714 shows that it is honored in Edge 13, but still hidden in IE 8..11. I can update the OP with this test case.

cc @gregwhitworth for opinions from Edge.

@zcorpan zcorpan added the interop Implementations are not interoperable with each other label Mar 28, 2017
@fantasai
Copy link
Contributor

I propose closing this issue as no change. We currently have interop across Gecko and Blink, I can't think of a use case for anything more complicated, and it's the simplest and most performant of the options presented.

@annevk
Copy link
Member

annevk commented Mar 11, 2021

Ah, so Blink changed something since #2134 (comment)? Sounds good. Does Safari need a bug?

@kojiishi
Copy link

kojiishi commented Mar 12, 2021

Ah, so Blink changed something since #2134 (comment)?

Yes, crbug.com/859416 in 2018.

@annevk
Copy link
Member

annevk commented Mar 12, 2021

cc @rniwa

@zcorpan
Copy link
Member Author

zcorpan commented Mar 30, 2021

This test covers this (through innerText, I don't know if there's a more direct test currently):

Lone <rp> ("<div><rp>abc</rp>")
https://wpt.fyi/results/html/dom/elements/the-innertext-idl-attribute/getter.html?label=experimental&label=master&aligned

@zcorpan
Copy link
Member Author

zcorpan commented Mar 30, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compat Standard is not web compatible or proprietary feature needs standardizing interop Implementations are not interoperable with each other topic: rendering
Development

No branches or pull requests

5 participants