-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
innerText: include parentheses around <rt> if there's no <rp> #1801
Comments
Yeah, falling back to parentheses when there is no |
cc @yosinch |
When there is no <rp> sibling to <rt>, include "(" before and ")" after <rt> in `innerText`'s getter. Fixes #1801.
PR for spec: #2113 |
@jfkthame is there interest to implement this in Gecko? |
@upsuper wdyt about this? Would you like to take it for gecko? |
There is an issue that, Gecko implements the ruby model from CSS Ruby spec, which is more complicated than that in the current HTML spec. The CSS model supports continuous [Slightly offtopic: this proposal actually again highlights the defect of HTML's ruby model. This model fails to express words like "振り仮名 → 振り仮名(ふりがな)" in a reasonable way which has desired behavior on both rendering and plain text. HTML spec should really adopt the CSS Ruby model.] There is also a question that whether the parentheses should be proportional or fullwidth (w3c/csswg-drafts#762). I think for CJK languages, majority of people would prefer either fullwidth parentheses or proportional parentheses with whitespace around. Maybe proportional parentheses are more desirable for other languages? Although it seems to me CJK languages (especially Japanese) are the main user of ruby. Personally I don't like to see the algorithm of |
Thanks @upsuper. So with I think fullwidth parentheses should be used if that is commonly used by CJK. You are correct that I'm happy to drop the proposal if people think it is not worth it. My question then is, should we also drop the special handling of |
(The ruby model is issue #121.) |
I'm fine with doing this if no one else opposes. |
I agree with @upsuper about the last paragraph of #1801 (comment). Introducing new behaivor which is not compatible with any existing implementation isn't welcome. |
Thanks. I've withdrawn the proposal. I will make a new pull request to drop the special handling of |
This was a hack that is only implemented in one engine (Gecko). For example, an <rp> in <select> is included, which is weird; if an <rp> has several text nodes, only the first is included. There is not enough implementor interest in making <ruby> actually work well in innerText (e.g. in the absense of <rp>); see #1801.
This was a hack that is only implemented in one engine (Gecko). For example, an <rp> in <select> is included, which is weird; if an <rp> has several text nodes, only the first is included. There is not enough implementor interest in making <ruby> actually work well in innerText (e.g. in the absense of <rp>); see #1801.
This was a hack that is only implemented in one engine (Gecko). For example, an <rp> in <select> is included, which is weird; if an <rp> has several text nodes, only the first is included. There is not enough implementor interest in making <ruby> actually work well in innerText (e.g. in the absense of <rp>); see #1801.
In #1801 (comment) it is pointed out that CJK typically use fullwidth parenthesis. Also expand the character references in the example now that the spec toolchain is not limited to ASCII.
In #1801 (comment) it is pointed out that CJK typically use fullwidth parenthesis. Also expand the character references in the example now that the spec toolchain is not limited to ASCII.
That’s note quite true. People DO use proportional (half-width) parenthesis in Japanese without spaces. I’ve rarely seen anyone inserting spaces around parenthesis in Japanese for that matter.
Inserting parenthesis is quite important for copy & paste (otherwise important content can be lost during copy). WebKit uses the same algorithm for both |
I agree, but since we have to choose one, I think you'll find "typically" if you look at referring bugs and discussion at I18N WG, and I agree with I18N that if we pick typically used one, that'd be fullwidth. The larger issue than width is the baseline. ASCII parentheses are usually designed to match to x-height, which is too low to use for CJK, while fullwidth parentheses are designed to match to em-height. There are a few fonts that has em-height parentheses for ASCII parentheses but they're really a few, I know only 3, because doing so sacrifices English rendering. In today's fonts environment, if we want parentheses that matches to CJK without extra spacing, we need to use fullwidth code points with
I'll leave @tkent-google on whether we want to do this or not. |
The problem here is that this would mean that the lack of |
I know some people are taking about Ruby's useful for Latin and other languages, but have never seen single page using it. Have you? Either way, it looks like Gecko and Blink doesn't want this. Maybe we should try to reach consensus on it first. Well, it was probably me who added the noise, sorry about that. |
This was a hack that is only implemented in one engine (Gecko). For example, an <rp> in <select> is included, which is weird; if an <rp> has several text nodes, only the first is included. There is not enough implementor interest in making <ruby> actually work well in innerText (e.g. in the absense of <rp>); see whatwg#1801.
In whatwg#1801 (comment) it is pointed out that CJK typically use fullwidth parenthesis. Also expand the character references in the example now that the spec toolchain is not limited to ASCII.
https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute
The
innerText
getter has a special case forText
nodes that are children ofrp
elements; the text is included even thoughrp
is 'display:none' by default.Demo: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4488
This is nice but I think it is more common to omit
rp
and only usert
, and in that case it's not helping.The rendering section has:
https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3
I think if we are going to special case ruby in
innerText
at all it would be good to make it "nice" also ifrp
is not being used, like in the rendering section.Concretely, if a
ruby
element has norp
children, include "(" beforert
children and ")" after.cc @rniwa @rocallahan @jfkthame
Implementer interest:
The text was updated successfully, but these errors were encountered: