first-letter doesn't apply on dash [maybe another punctuation symbols]

RESOLVED FIXED in Firefox 48

Status

()

defect
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: worg, Assigned: mats)

Tracking

({dev-doc-needed})

unspecified
mozilla48
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox48 fixed)

Details

Attachments

(2 attachments)

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:47.0) Gecko/20100101 Firefox/47.0
Build ID: 20160328004018

Steps to reproduce:

Testcase
http://codepen.io/worg/pen/wGqBLd


Actual results:

The ::first-letter CSS pseudo-element rules aren't applied to the first element [the one containing a dash]


Expected results:

The CSS rules should apply to all elements
Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
(Assignee)

Comment 1

3 years ago
It seems CSS2 intentionally excluded the Pd class of punctuation (to which "dash" (002D) belongs).
https://www.w3.org/TR/CSS2/selector.html#first-letter

The relevant spec now says:
"Punctuation (i.e, characters that belong to the Punctuation (P*) Unicode general category [UAX44]) that precedes or follows the first typographic letter unit must also be included in the ::first-letter pseudo-element."
https://drafts.csswg.org/css-pseudo-4/#first-letter-pseudo
Assignee: nobody → mats
Status: UNCONFIRMED → NEW
Component: CSS Parsing and Computation → Layout
Ever confirmed: true
OS: Unspecified → All
Hardware: Unspecified → All
Version: 47 Branch → unspecified
(Assignee)

Comment 3

3 years ago
When this lands we should update the following text on the MDN page:
https://developer.mozilla.org/en/docs/Web/CSS/::first-letter
"Punctuation, that is any characters defined in Unicode in the open (Ps), close (Pe), initial quote (Pi), final quote (Pf) and other punctuation (Po) classes, preceding or immediately following the first letter is also matched by this pseudo-element."

The new spec text is the paragraph that starts with: "Punctuation (i.e, characters that belong to..."
https://drafts.csswg.org/css-pseudo-4/#first-letter-pseudo
Keywords: dev-doc-needed
Comment on attachment 8736086 [details] [diff] [review]
fix+test

Review of attachment 8736086 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/reftests/first-letter/399941-2-ref.html
@@ +12,5 @@
>   </head>
>   <body>
> + <!-- Punctuation in class Pc should be included: there is a first-letter here -->
> +  <p><span class="fake-first-letter">_I_,</span> said the Fly,</p>
> + <!-- Punctuation in class Pc should be included: there is a first-letter here -->

s/Pc/Pd/ in the second of these comments
Attachment #8736086 - Flags: review?(jfkthame) → review+

Comment 6

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/3766631a655f
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
(Assignee)

Updated

3 years ago
Flags: in-testsuite+

Comment 7

3 years ago
(In reply to Mats Palmgren (:mats) from comment #3)
> When this lands we should update the following text on the MDN page:
> https://developer.mozilla.org/en/docs/Web/CSS/::first-letter
> "Punctuation, that is any characters defined in Unicode in the open (Ps),
> close (Pe), initial quote (Pi), final quote (Pf) and other punctuation (Po)
> classes, preceding or immediately following the first letter is also matched
> by this pseudo-element."
> 
> The new spec text is the paragraph that starts with: "Punctuation (i.e,
> characters that belong to..."
> https://drafts.csswg.org/css-pseudo-4/#first-letter-pseudo

Are you going to support text-emphasis* and opacity properties?
You need to log in before you can comment on or make changes to this bug.