Re: [svgwg] ::selection and other highlights in SVG (#894)

I want to come back to this old issue because Safari/Chrome have a different behavior than Firefox. 


I created a test case. 

[test-svg-text-selection.html](https://github.com/user-attachments/files/22631538/test-svg-text-selection.html)

which is basically

```
    <style>
        text {fill: red;}
        svg {display: block; margin: 10px}
        #test2 text {color: green}
        #test3 text {fill: green}
        #test4 text::selection {color: green}
        #test5 text::selection {fill: green}
    </style>

<svg id="test1" width="600" height="60" style="border: black solid 3px;"> <text x="50" y="40" font-size="30">text. Normal</text></svg>
<svg id="test2" width="600" height="60" style="border: black solid 3px;"> <text x="50" y="40" font-size="30">text. color: green</text></svg>
<svg id="test3" width="600" height="60" style="border: black solid 3px;"> <text x="50" y="40" font-size="30">text. fill: green</text></svg>
<svg id="test4" width="600" height="60" style="border: black solid 3px;"> <text x="50" y="40" font-size="30">select me. ::text-selection {color: green}</text></svg>
<svg id="test5" width="600" height="60" style="border: black solid 3px;"> <text x="50" y="40" font-size="30">select me. ::text-selection {fill: green}</text></svg>
```

The results are 

Here's the CSV data formatted as a GitHub markdown table:

**color of the text**

| test | safari | firefox | normal |
|------|--------|---------|--------|
| text normal | red | red | red |
| text with color:green | red | red | red |
| text with fill:green | green | green | green |
| selected text with color:green | nothing | green | nothing |
| selected text with fill:green | green | black | green |


The results of Safari/Chrome seems more logical, except for the non visibility of the selection with `color:green`.

The specification doesn't say how this should apply with regards to CSS. 



-- 
GitHub Notification of comment by karlcow
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/894#issuecomment-3354860239 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 1 October 2025 05:57:09 UTC