Closed Bug 1260366 Opened 4 years ago Closed 4 years ago

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

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: worg, Assigned: mats)

Details

(Keywords: dev-doc-needed)

Attachments

(2 files)

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
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
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+
https://hg.mozilla.org/mozilla-central/rev/3766631a655f
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Flags: in-testsuite+
(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.