construct-stylesheets icon indicating copy to clipboard operation
construct-stylesheets copied to clipboard

construct stylesheet priority

Open mantou132 opened this issue 4 years ago • 2 comments

const sheet = new CSSStyleSheet();
sheet.replaceSync(`
  h1 {
    color: blue;
  }
`);

document.adoptedStyleSheets = [sheet];

document.body.innerHTML = `
  <style>
    h1 {
      color: red;
    }
  </style>
  <h1>title</h1>
`;

construct stylesheet overrides <style>.

but sometimes I don't want to override the style of <style> <link> in the code, I just want to construct stylesheet to work like a browser stylesheet. // case: <gem-frame>

is there a way to determine the priority of constructing stylesheet?

mantou132 avatar Mar 20 '20 06:03 mantou132

This was discussed and resolved here: https://github.com/WICG/construct-stylesheets/issues/93#issuecomment-577713131

As of right now, constructed always go after other author sheets.

nordzilla avatar Mar 20 '20 06:03 nordzilla