Closed Bug 1540385 Opened 6 years ago Closed 6 years ago

CSS selector nth-of-type is broken in SVG use shadow trees.

Categories

(Core :: CSS Parsing and Computation, defect, P3)

67 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox-esr60 --- unaffected
firefox66 --- wontfix
firefox67 --- fixed
firefox68 --- fixed

People

(Reporter: grekovdmitry16, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

Attached image test.svg

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0

Steps to reproduce:

I am using "nth-of-type" CSS selectors in SVG images for paths inside <defs> tag. It worked in older version (I don't know exact version) and works in other browsers., however, it doesn't work in several latest versions.

Actual results:

In attached file only "nth-of-type(2)" works, but not "nth-of-type(3)". Also "~" selector is not working in the same way. Note that if I move contents out of <defs> tag, everything works.

Expected results:

Both "nth-of-type(2)" and "nth-of-type(3)" should work.
Both "pathpath" and "pathpath~path" should work.

Strage, but, if I add class (doesn't matter what) to each <path> element, selectors begin to work.

Component: Untriaged → SVG
Product: Firefox → Core

mozregression tells me this was caused by bug 1502893.

Blocks: 1502893
Status: UNCONFIRMED → NEW
Component: SVG → CSS Parsing and Computation
Ever confirmed: true
Flags: needinfo?(emilio)
Keywords: regression
Priority: -- → P3
No longer blocks: 1502893
Regressed by: 1502893

I can see how this broke.

Summary: CSS selector nth-of-type is broken in SVG <defs> tag → CSS selector nth-of-type is broken inSVG use shadow trees.
Flags: needinfo?(emilio)
Summary: CSS selector nth-of-type is broken inSVG use shadow trees. → CSS selector nth-of-type is broken in SVG use shadow trees.
Assignee: nobody → emilio

So as to avoid incorrectly sharing styles across elements.

And it's probably worth uplifting this.

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/625e9335159c
Fix revalidation in <svg:use> subtree. r=heycam

Comment on attachment 9055425 [details]
Bug 1540385 - Fix revalidation in <svg:use> subtree. r=#style

Beta/Release Uplift Approval Request

  • Feature/Bug causing the regression: Bug 1502893
  • User impact if declined: Some selectors not working properly in SVG <use> elements.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): one-line change that jumps out the <svg:use> shadow root to look up style rules like we do everywhere else.
  • String changes made/needed: none
Attachment #9055425 - Flags: approval-mozilla-beta?
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Has Regression Range: --- → yes
Has STR: --- → yes

Comment on attachment 9055425 [details]
Bug 1540385 - Fix revalidation in <svg:use> subtree. r=#style

Low-risk oneliner patch with tests fixing a svg regression, uplift approved for 67 beta9, thanks.

Attachment #9055425 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: qe-verify-
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/16516 for changes under testing/web-platform/tests
Upstream PR merged
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: