Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/chat/chat.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,11 @@ describe('Chat', () => {
const styles = document.createElement('style');
styles.setAttribute('id', 'adopt-styles-test');
styles.innerHTML = `
.custom-background {
background-color: rgb(255, 255, 0);
}

/* override */
.custom-background {
background-color: rgb(255, 0, 0);
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/common/controllers/adopt-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ class AdoptedStylesController implements ReactiveController {
}

try {
constructed.insertRule(rule.cssText);
// insert last to keep rules/override order:
constructed.insertRule(rule.cssText, constructed.cssRules.length);
hasRules = true;
} catch {
// Skip rules that cannot be cloned (e.g., invalid syntax)
Expand Down