Email or username:

Password:

Forgot your password?
Top-level
Amelia Bellamy-Royds

@jaffathecake The last option (automatically linking the cloned subtree to the original) is basically what SVG use elements do. It seems completely doable if (and only if) the cloned shadow tree within the <selectedoption> element is read-only, which I'm assuming it would be.

8 comments
Christian "Schepp" Schaefer

@AmeliaBR @jaffathecake I would favor that solution, too. And maybe we can generalize this approach, too, so that @kizu gets something new to play with (and crash the browser): front-end.social/@kizu/1132845

Jake Archibald

@AmeliaBR that's one of the weird things: the clone lives within the light DOM, not the shadow DOM. It has to to allow full styling.

Amelia Bellamy-Royds

@jaffathecake That is really weird & problematic, IMO. Is there any other case where the browser dynamically injects content in the light DOM?

Are styling hooks for shadow DOM still so bad that can't be adjusted?

Alternatively, again borrowing from SVG convention: The cloned element within a <use> brings with it style rules from its original context. For the selectedoption use case, you could then add a pseudoclass or host rule that matches the original element only in the cloned context.

Jake Archibald

@AmeliaBR I agree it's really weird. The only similar thing I can think of is contenteditable, but that's pretty different. But yeah, styling arbitrary shadow content is harrrrd.

Anne van Kesteren

@jaffathecake @AmeliaBR Styling is not the issue per se. Running script is.

Ollie Boermans

@AmeliaBR @jaffathecake doesn’t count as content – closest I can think of is tbody

```
<style>
tbody {
outline: solid tomato;
}
</style>
<table>
<tr><td>World</td></tr>
</table>
```

Jake Archibald

@ollicle @AmeliaBR yeahhhh, I think parser changes are different to interaction changes

Ollie Boermans

I can hear the nahhh balancing that yeahhh :emoji_squint:

Understood.

Go Up