Skip to content

Commit

Permalink
underp GC
Browse files Browse the repository at this point in the history
  • Loading branch information
azukaar committed Sep 12, 2018
1 parent dd3016d commit 16340b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"test": "cross-env NODE_ENV=test jest",
"test-ci": "cross-env NODE_ENV=test jest --coverage; cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"start": "webpack-serve",
"build": "webpack -p",
"prepublish": "npm run build; npm run test"
"build": "webpack"
},
"serve": {
"content": [
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ const clearCSS = function (_i = 0) {
if (_i > sheet.cssRules.length) _i = 0;
for (let i = _i; i < _i + nbToIt; i++) {
if (sheet.cssRules[i] && sheet.cssRules[i].selectorText) {
const className = sheet.cssRules[i].selectorText.split('.')[1].split(':')[0];
const className = sheet.cssRules[i].selectorText.split('.')[1].split(':')[0].split(' ')[0];

if (documentElement.getElementsByClassName(className).length === 0) {
sheet.deleteRule(i);
}
} else if(sheet.cssRules[i]){
Array.from(sheet.cssRules[i].cssRules).forEach( (value) => {
const className = value.selectorText.split('.')[1].split(':')[0];
const className = value.selectorText.split('.')[1].split(':')[0].split(' ')[0];

if (documentElement.getElementsByClassName(className).length === 0) {
sheet.deleteRule(i);
Expand Down

0 comments on commit 16340b3

Please sign in to comment.