Skip to content

Commit cd22636

Browse files
fix: remove all attributes can cause some errors when using livewire
1 parent 976a55e commit cd22636

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/content.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,8 @@ export function processIcon(newIcon) {
162162
// ⚠️ icon.remove() causes issues with some websites
163163
// https://github.com/furybee/chrome-tab-modifier/issues/354
164164
// icon.remove();
165-
// Instead, remove all attributes
166-
icon.getAttributeNames().forEach((attr) => {
167-
icon.removeAttribute(attr);
168-
});
165+
// Instead, we'll just change the rel attribute
166+
icon.setAttribute('rel', 'old-icon');
169167
});
170168

171169
const iconUrl = /^(https?|data):/.test(newIcon)

src/content.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ describe('Content', () => {
248248
processIcon('new-icon.png');
249249
const oldIcon = document.querySelector('link[href="old-icon.png"]');
250250
const newIcon = document.querySelector('link[href*="new-icon.png"]');
251-
expect(oldIcon).toBeFalsy();
251+
252+
expect(oldIcon).toBeTruthy();
253+
expect(oldIcon.rel).toBe('old-icon');
252254
expect(newIcon).toBeTruthy();
253255
});
254256
});

0 commit comments

Comments
 (0)