Skip to content

Commit

Permalink
Added comments clarifying atomicSelector and selector
Browse files Browse the repository at this point in the history
  • Loading branch information
renatoi committed May 6, 2015
1 parent 0cb9ac6 commit 197b0c8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/atomizer.js
Expand Up @@ -153,11 +153,20 @@ Atomizer.prototype.parseConfig = function (config/*:AtomizerConfig*/, options/*:
}

// check where this rule belongs to
// atomicSelector is the class name before the params: e.g. className(param)
// selector is the class name if params is not required
// we look both in rules and in helpers where this class belongs to
if (this.rulesMap.hasOwnProperty(match.atomicSelector)) {
ruleIndex = this.rulesMap[match.atomicSelector];
} else if (this.helpersMap.hasOwnProperty(match.atomicSelector)) {
}
// the atomicSelector can also be a helper that requires params
else if (this.helpersMap.hasOwnProperty(match.atomicSelector)) {
ruleIndex = this.helpersMap[match.atomicSelector];
} else if (this.helpersMap.hasOwnProperty(match.selector)) {
}
// or it can be just a class with no params required
// this is only possible for helper classes as param is required for
// all atomic classes in rulesMap.
else if (this.helpersMap.hasOwnProperty(match.selector)) {
ruleIndex = this.helpersMap[match.selector];
} else {
// not a valid class, no op
Expand Down

0 comments on commit 197b0c8

Please sign in to comment.