feat(aio): set “avoid” class by convention (filename has “.avoid.”)

Most important for StyleGuide which lost example css class in migration.
Also hides copy for “avoid” files.
This commit is contained in:
Ward Bell
2017-05-02 22:39:14 -07:00
committed by Matias Niemelä
parent 673d8ae583
commit 9ca2b4c967
5 changed files with 58 additions and 42 deletions

View File

@ -17,16 +17,19 @@ export function getAttrs(el: HTMLElement | ElementRef): StringMap {
}
/**
* Return the attribute that matches `atty`.
* @param atty Name of the attribute or a string of candidate attribute names
* Return the attribute that matches `attr`.
* @param attr Name of the attribute or a string of candidate attribute names
*/
export function getAttrValue(attrs: StringMap, attr: string | string[] = ''): string {
return attrs[typeof attr === 'string' ? attr : attr.find(a => attrs[a] !== undefined)];
return attrs[typeof attr === 'string' ?
attr.toLowerCase() :
attr.find(a => attrs[a.toLowerCase()] !== undefined)
];
}
/**
* Return the boolean state of an attribute value (if supplied)
* @param attyValue The string value of some attribute (or undefined if attribute not present)
* @param attrValue The string value of some attribute (or undefined if attribute not present)
* @param def Default boolean value when attribute is undefined.
*/
export function boolFromValue(attrValue: string, def: boolean = false) {