prepareTemplateStyles(template, elementName, typeExtension) {
    if (template._prepared || disableRuntime) {
      return;
    }
    // style placeholders are only used when ShadyDOM is active
    if (!nativeShadow) {
      ensureStylePlaceholder(elementName);
    }
    template._prepared = true;
    template.name = elementName;
    template.extends = typeExtension;
    templateMap[elementName] = template;
    let cssBuild = StyleUtil.getCssBuild(template);
    const optimalBuild = StyleUtil.isOptimalCssBuild(cssBuild);
    let info = {
      is: elementName,
      extends: typeExtension,
    };
    let cssText = this._gatherStyles(template) + (adoptedCssTextMap[elementName] || '');
    // check if the styling has mixin definitions or uses
    this._ensure();
    if (!optimalBuild) {
      let hasMixins = !cssBuild && detectMixin(cssText);
      let ast = parse(cssText);
      // only run the applyshim transforms if there is a mixin involved
      if (hasMixins && nativeCssVariables && this._applyShim) {
        this._applyShim['transformRules'](ast, elementName);
      }
      template['_styleAst'] = ast;
    }
    let ownPropertyNames = [];
    if (!nativeCssVariables) {
      ownPropertyNames = StyleProperties.decorateStyles(template['_styleAst']);
    }
    if (!ownPropertyNames.length || nativeCssVariables) {
      let root = nativeShadow ? template.content : null;
      let placeholder = getStylePlaceholder(elementName);
      let style = this._generateStaticStyle(info, template['_styleAst'], root, placeholder, cssBuild, optimalBuild ? cssText : '');
      template._style = style;
    }
    template._ownPropertyNames = ownPropertyNames;
  }
Prepare styling for the given element type
@param {!HTMLTemplateElement} template
@param {string} elementName
@param {string=} typeExtension