Skip to content

Commit

Permalink
fix: miscellaneous improvements
Browse files Browse the repository at this point in the history
* Split code to separate files
* Add Rollup build with detection injection
* Attempt to work together with ShadyCSS
  • Loading branch information
Lodin committed Sep 2, 2019
1 parent 3d0d28c commit 2895c86
Show file tree
Hide file tree
Showing 19 changed files with 1,050 additions and 848 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.coverage
dist
node_modules
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"bracketSpacing": false,
"printWidth": 80,
"trailingComma": "none",
"trailingComma": "all",
"tabWidth": 2,
"singleQuote": true
}
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ This polyfill should work as-is in modern browsers, however, to support IE11, yo

## Installation

The package can be installed either by copying the [polyfill file](./adoptedStyleSheets.js) or by [installing using npm](https://docs.npmjs.com/getting-started/).
```bash
npm i construct-style-sheets-polyfill
```
or
```bash
yarn add construct-style-sheets-polyfill
```
or
```javascript
import 'https://unpkg.com/construct-style-sheets-polyfill';
```

## Usage

Expand Down Expand Up @@ -56,4 +66,4 @@ const testEl = new TestEl;
document.body.appendChild(testEl);
```

The polyfill will append new `style` tags to the designated `DocumentOrShadowRoot`. Manually removing the style node will cause a re-insertion of the styles at the designated root. To remove a style sheet, you _must_ remove the style element from the `element.adoptedStyleSheets` array. The behavior here is supposed to emulate a `FrozenArray`, so modifying the array in question will have no effect until the value is changed using a setter.
The polyfill will append new `style` tags to the designated `DocumentOrShadowRoot`. Manually removing the style node will cause a re-insertion of the styles at the designated root. To remove a style sheet, you _must_ remove the style element from the `element.adoptedStyleSheets` array. The behavior here is supposed to emulate a `FrozenArray`, so modifying the array in question will have no effect until the value is changed using a setter.
Loading

0 comments on commit 2895c86

Please sign in to comment.