Brave overwrites document.adoptedStyleSheets
See original GitHub issueDescription
When you load a document that adds something to document.adoptedStyleSheets
, Brave will remove that and replace it with Brave’s own content_cosmetic.cosmeticStyleSheet
Steps to Reproduce
<html>
<head>
<script>
const sheet = new CSSStyleSheet();
sheet.replaceSync(`
span { color: blue }
`);
document.adoptedStyleSheets = [sheet, ...document.adoptedStyleSheets];
</script>
<body>
<span>I should be blue</span>
</body
Live version at https://artur.app.fi/brave-styles.html
Actual result:
Text is black
Expected result:
Text is blue
Reproduces how often:
Always
Desktop Brave version:
1.20.103 Chromium: 88.0.4324.152 (Official Build) (x86_64)
Version/Channel Information:
- Can you reproduce this issue with the current release? Yes
Other Additional Information:
- Does the issue resolve itself when disabling Brave Shields? Yes
- Does the issue resolve itself when disabling Brave Rewards? No
- Is the issue reproducible on the latest version of Chrome? No
Miscellaneous Information:
Caused by overwriting document.adoptedStyleSheets instead of appending
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Support cosmetic filtering `!important` display overrides in ...
It is still not yet supported in Standard shields mode due to the use of document.adoptedStyleSheets . The addRule and removeRule APIs it ......
Read more >Document.adoptedStyleSheets - Web APIs | MDN
The adoptedStyleSheets property of the Document interface is used for setting an array of constructed stylesheets to be used by the document.
Read more >Constructable Stylesheets - web.dev
Constructable Stylesheets provide a seamless way to create and distribute styles to documents or shadow roots without worrying about FOUC.
Read more >Where can I change default css styles for Brave browser?
I am using personalized high contrast visuals in my Windows 10 OS but this overrides browser rendering for all webpages.
Read more >A Quick Look at Constructable Stylesheets
We use created stylesheets by using the adoptedStyleSheets property which Documents and Shadow DOMs possess. This property lets us explicitly ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
^ cc @pes10k @SergeyZhukovsky
thanks for opening a PR
Verification passed on the following devices running 1.21.71 x64 build
Verification passed on
1.20.110
1.21.71
Verification passed on
Verified test plan from the description
Verification passed on
1.20.110
1.21.71