You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-pseudo] ::first-letter should include whitespace #2164
The section on ::first-letter says nothing about whitespace, and a css-backgrounds WPT test even tests that whitespace is not selected by ::first-letter. However, all implementations fail this test:
Edge selects whitespace no matter if it is followed by a non-whitespace character or not
Firefox only selects whitespace that is not followed by a non-whitespace character
Chrome (and I assume WebKit) only selects whitespace that is followed by a non-whitespace character
Given that all implementations select whitespace of some sort in ::first-letter, but each does it differently, it is probably appropriate to clarify this in the spec.
thinsp, emsp like endash and emdash are general interpuction (decorative) signs. Not letters.
Due to this thinsp etc. should behave like other UTF-8 interpenction signs even if they are written as entity. MSIE handles that correctly.
Thus, need clarification. I guess the Moz implementation is most logic except for "thinsp, nbsp" etc. The nbsp thinsp and normal spaces (in pre-wrap mode etc.) should be treated like endash and emdash. It is most logic - all signs that are not letters or digits should be included inside ::first-letter pseudoelement.
But: how to define which ranges of unicode are digits or letters.
All "General Punctuation unicode subset (0x20xx)" can be treated as not digit and not letter, but Unicode Math Block?
Here is needed to specify due to UTF-8 - ranges that are letters or digits.
We've clarified in #5154 that we capture intervening white space, between a preceding or following punctuation character and the first letter. So I think this issue technically is closed. But the example @csnardi points out shows that this is pretty broken in some cases, so I filed #5830 as a follow-up.
Activity
Nadya678 commentedon Jan 6, 2018
But the name is ::first-LETTER. Whitespace is not letter and also digits are not letters.
The IE11 behaviour. Letter means letter.
BTW. Remove HTML bugs from your code. It can enable quirks modes in browsers. I corrected the HTML.
https://jsfiddle.net/avf3qtrj/
IE11: after correcting HTML errors (multiple body tags).

Nadya678 commentedon Jan 6, 2018
Test also this on Firefox. It means first letter.
https://jsfiddle.net/gpq6ncwg/1/
thinsp, emsp like endash and emdash are general interpuction (decorative) signs. Not letters.
Due to this thinsp etc. should behave like other UTF-8 interpenction signs even if they are written as entity. MSIE handles that correctly.
csnardi commentedon Jan 11, 2018
A real-world example of the interoperability confusion is https://bugs.chromium.org/p/chromium/issues/detail?id=638267.
Nadya678 commentedon Jan 12, 2018
Thus, need clarification. I guess the Moz implementation is most logic except for "thinsp, nbsp" etc. The nbsp thinsp and normal spaces (in pre-wrap mode etc.) should be treated like endash and emdash. It is most logic - all signs that are not letters or digits should be included inside ::first-letter pseudoelement.
But: how to define which ranges of unicode are digits or letters.
All "General Punctuation unicode subset (0x20xx)" can be treated as not digit and not letter, but Unicode Math Block?
Here is needed to specify due to UTF-8 - ranges that are letters or digits.
csnardi commentedon Jan 23, 2018
Another real-world example: https://bugs.webkit.org/show_bug.cgi?id=163216. Since WebKit selects spaces everywhere,
A "b"will haveA "selected.fantasai commentedon Dec 31, 2020
We've clarified in #5154 that we capture intervening white space, between a preceding or following punctuation character and the first letter. So I think this issue technically is closed. But the example @csnardi points out shows that this is pretty broken in some cases, so I filed #5830 as a follow-up.