[Webkit-unassigned] [Bug 204687] New: CSS Rules with the same selector from several large stylesheets are applied in the wrong order
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Nov 28 10:20:43 PST 2019
https://bugs.webkit.org/show_bug.cgi?id=204687
Bug ID: 204687
Summary: CSS Rules with the same selector from several large
stylesheets are applied in the wrong order
Product: WebKit
Version: Safari 13
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: CSS
Assignee: webkit-unassigned at lists.webkit.org
Reporter: subzey at gmail.com
Created attachment 384463
--> https://bugs.webkit.org/attachment.cgi?id=384463&action=review
Error reproduction demo and a screenshot
In some cases rules with the same selector from the different stylesheets override each other in the wrong order.
It is reproduced with the large stylesheets (> 10000 rules, probably less) and is somehow related to the count of css rules in those stylesheets. Most noticeable the error is when the count of rules is near power of two.
The reproduction demo is attached to this issue, or can be accessed https://saf-rule-order.subzey.now.sh/dist/0x7fff/ or GitHub: https://github.com/subzey/saf-rule-order/tree/master/dist
There are 20 styleheets on a page. Each features a rule that sets the ::before contents on the body element. Other than these rules each sheet contains lots of other rules, so there are 32767 total (0x7FFF). The contents of these "dummy" rules doesn't matter, it can be even empty.
*Expected:*
Once all the selectors are the same, the rule from the last stylesheet should "win" and the body::before contents should be "Hello from 20.css".
*Actual Behavior:*
It says, "Hello from 09.css". The Inspector shows the order of rules application (see the attached screenshot) and it's totally random and does not reflect the DOM order of link elements.
This order is changed if the count of "dummy" rules is changed. https://saf-rule-order.subzey.now.sh/dist/0x8000/ 32768 rules yields "Hello from 16.css"
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20191128/16d0cdd2/attachment.htm>
More information about the webkit-unassigned
mailing list