Skip to content

Commit 7151dd5

Browse files
author
Gusted
authored
Revert "Only style <a> with a href link (darkreader#9843)" (darkreader#9874)
- Resolves darkreader#9870 - This reverts commit 50ab9b9.
1 parent 0728041 commit 7151dd5

3 files changed

Lines changed: 3 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
## Unreleased
2-
3-
- Don't style `<a>` elements without a link(href attribute) anymore. Only those with a link.
4-
51
## 4.9.57 (Aug 23, 2022)
62

73
- Fix iframes not getting modified when settings were changed.

src/inject/dynamic-theme/modify-css.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function getModifiedUserAgentStyle(theme: Theme, isIFrame: boolean, style
112112
lines.push(` border-color: ${modifyBorderColor({r: 76, g: 76, b: 76}, theme)};`);
113113
lines.push(` color: ${modifyForegroundColor({r: 0, g: 0, b: 0}, theme)};`);
114114
lines.push('}');
115-
lines.push('a:any-link {');
115+
lines.push('a {');
116116
lines.push(` color: ${modifyForegroundColor({r: 0, g: 64, b: 255}, theme)};`);
117117
lines.push('}');
118118
lines.push('table {');

tests/inject/dynamic/style-override.tests.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,13 @@ describe('STYLE ELEMENTS', () => {
5050
it('should override User Agent style', async () => {
5151
container.innerHTML = multiline(
5252
'<span>Text</span>',
53-
'<a href="#" class="href">Link</a>',
54-
'<a class="non-href">Non-link</a>'
53+
'<a href="#">Link</a>',
5554
);
5655
createOrUpdateDynamicTheme(theme, null, false);
5756
expect(getComputedStyle(container).backgroundColor).toBe('rgb(0, 0, 0)');
5857
expect(getComputedStyle(container).color).toBe('rgb(255, 255, 255)');
5958
expect(getComputedStyle(container.querySelector('span')).color).toBe('rgb(255, 255, 255)');
60-
expect(getComputedStyle(container.querySelector('.href')).color).toBe('rgb(51, 145, 255)');
61-
expect(getComputedStyle(container.querySelector('.non-href')).color).toBe('rgb(255, 255, 255)');
59+
expect(getComputedStyle(container.querySelector('a')).color).toBe('rgb(51, 145, 255)');
6260
});
6361

6462
it('should override static style', async () => {

0 commit comments

Comments
 (0)