All files / src/designs design-attributes.ts

11.11% Statements 1/9
0% Branches 0/2
0% Functions 0/1
11.11% Lines 1/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25    1x                                            
import { ViewCompiler, ViewResources } from 'aurelia-templating';
 
export function processDesignAttributes(
  _: ViewCompiler,
  __: ViewResources,
  node: Element,
  attributes: NamedNodeMap,
  ___: any) {
  const prefix = 'material-'; // TODO: get this from somewhere
  const length = prefix.length;
 
  // tslint:disable:prefer-const
  for (let i = 0, ii = attributes.length; i < ii; ++i) {
    const current = attributes[i];
 
    if (current.name.indexOf(prefix) === 0) {
      const realName = current.name.substring(length);
      node.setAttribute(realName, current.value);
    }
  }
  // tslint:enable:prefer-const
 
  return true;
}