Skip to content

construct stylesheet priority #127

@mantou132

Description

@mantou132
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions