-
Notifications
You must be signed in to change notification settings - Fork 759
[css-cascade] Cascade priority of presentation hints vs. tree scopes #6659
Description
This issue affects CSS Cascade Level 4 and 5, both of which have defined the cascade priority comparison between tree scopes, but are not clear which tree scope presentational hints belong to (when UA treats them as author style).
Level 4 says they are "in their own cascade layer placed as the lowest layer in the author origin".
Neither says anything about tree scopes, so I'll assume they belong to the same tree scope as the element itself.
As a result, when comparing presentational hints vs. :host or ::slotted rules from a shadow tree, presentational hints win because they are in an outer tree scope (see example below). This seems wrong, as the intention of the spec seems to be that any author rule can beat presentational hints.
To fix it, I'm proposing adding presentational hints as an independent sorting criterion into context, so that when comparing presentation hints with other rules, presentational hints never win.
<div id=host>
<img width=100 height=100 style="background-color: green">
<template shadowroot=open>
<slot></slot>
<style>
::slotted(img) {
width: 200px;
}
</style>
</template>
</div>If we treat presentational hints as author style in the same tree scope as the element, then the result width of the image should be 100px because the presentational hint beats the ::slotted rule. Fortunately, I haven't seen any browser implement this behavior (tested Chrome, Firefox and Safari), so this is probably just a spec bug fix.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Issue actions