Skip to content

Commit

Permalink
Merge JS for #31 and #6
Browse files Browse the repository at this point in the history
  • Loading branch information
LeaVerou committed Sep 16, 2020
1 parent 1523d16 commit 62d1748
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
22 changes: 0 additions & 22 deletions js/06-pseudos.js

This file was deleted.

6 changes: 4 additions & 2 deletions js/31-classes-ids.js → js/31-selector-parts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ export default function compute() {
let ret = {
class: {},
id: {},
attribute: {}
attribute: {},
"pseudo-class": {},
"pseudo-element": {}
};

walkSelectors(ast, selector => {
let sast = parsel.parse(selector, {list: false});

parsel.walk(sast, node => {
if (node.type === "id" || node.type === "class" || node.type === "attribute") {
if (node.type in ret) {
incrementByKey(ret[node.type], node.name);
}
}, {subtree: true});
Expand Down

0 comments on commit 62d1748

Please sign in to comment.