wesee - lint

This commit is contained in:
dntzhang 2019-01-29 09:14:32 +08:00
parent eedf27f0c9
commit bcfb47afb7
2 changed files with 17 additions and 16 deletions

3
.gitignore vendored
View File

@ -16,4 +16,5 @@ package-lock.json
/packages/*/yarn.lock
/packages/*/yarn-error.log
npm-debug.log
npm-debug.log
/packages/*/todo.md

View File

@ -6,7 +6,7 @@ import CSSRuleSet from './css-rule-set'
*/
class StyleSheet {
constructor(){
constructor() {
//Array<CSSRuleSet>
this.rulesets = []
}
@ -17,32 +17,32 @@ class StyleSheet {
* @param sel <String> - Selector-String to search for
* @return Null<CSSRuleSet>
*/
getSet(sel ) {
for(let i=0,len=this.rulesets.length;i<len;i++){
if(sel==this.rulesets[i].selector){
return this.rulesets[i]
}
getSet(sel) {
for (let i = 0, len = this.rulesets.length; i < len; i++) {
if (sel == this.rulesets[i].selector) {
return this.rulesets[i]
}
}
}
}
/**
* Queries whether a rule-set exists with the given selector-string
* @param sel <String> - Selector-String to search for
* @return Bool
*/
hasSet(sel) {
return this.getSet(sel) !== undefined
}
hasSet(sel) {
return this.getSet(sel) !== undefined
}
/**
* creates a new rule-set, adds it to the list of rule-sets, and returns it
* @param sel < Null<String> > - optional Selector-String to associate with created rule-set
*/
addSet(sel ) {
const set = new CSSRuleSet(sel)
addSet(sel) {
const set = new CSSRuleSet(sel)
this.rulesets.push(set)
this.rulesets.push(set)
return set
}
return set
}
}