Skip to content

Commit

Permalink
improve logging invalid rule and fix description
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Jan 18, 2023
1 parent 9191fc8 commit 5443317
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scriptlets/inject-css-in-shadow-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
/**
* @scriptlet inject-css-in-shadow-dom
* @description
* Injects css rule into selected Shadow DOM subtrees on a page
* Injects CSS rule into selected Shadow DOM subtrees on a page
*
* **Syntax**
* ```
Expand Down Expand Up @@ -53,8 +53,8 @@ export function injectCssInShadowDom(source, cssRule, hostSelector = '') {
const stylesheet = new CSSStyleSheet();
try {
stylesheet.insertRule(cssRule);
} catch {
logMessage(source, `Failed to parse the rule: ${cssRule}`);
} catch (e) {
logMessage(source, `Unable to apply the rule '${cssRule}' due to: \n'${e.message}'`);
return;
}
shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, stylesheet];
Expand Down

0 comments on commit 5443317

Please # to comment.