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AC,GAAE,CAAG,KAAG,CAAG,CAAA,UAAS,IAAI,AAAC,CAAC,IAAG,CAAG,KAAG,CAAC,CAAC,CAAC;AAC9D,wBAAsB,AAAC,CAAC,GAAE,CAAG,QAAM,CAAG,CAAA,UAAS,IAAI,AAAC,CAAC,IAAG,CAAG,QAAM,CAAC,CAAC,CAAC;AACpE,WAAS,QAAQ,AAAC,CAAC,IAAG,GAAG,SAAC,QAAO,CAAG,CAAA,OAAM,CAAM;AAC5C,OAAI,OAAM,IAAM,KAAG,CAAA,EAAK,CAAA,OAAM,IAAM,QAAM,CAAG;AACzC,4BAAsB,AAAC,CAAC,GAAE,CAAG,QAAM,CAAG,SAAO,CAAC,CAAC;IACnD;AAAA,EACJ,EAAC,CAAC;AAEF,IAAE,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;AACZ,OAAO,CAAA,GAAE,SAAS,AAAC,EAAC,CAAC;AACvB;AAGA,OAAS,wBAAsB,CAAE,MAAK,AAAa,CAAG,CAAA,OAAM,AAAO,CAAG,CAAA,QAAO,CAAG;AAC9E,KAAI,SAAQ,AAAC,CAAC,QAAO,CAAC,CAAG;AACrB,OAAI,QAAO,OAAO,IAAM,EAAA,CAAG;AACvB,WAAK,IAAI,AAAC,CAAC,GAAE,EAAI,QAAM,CAAC,CAAC;IAC7B,KAAO;AACH,WAAK,IAAI,AAAC,CAAC,GAAE,EAAI,QAAM,CAAA,CAAI,KAAG,CAAA,CAAI,SAAO,CAAA,CAAI,IAAE,CAAC,CAAC;IACrD;AAAA,EACJ;AAAA,AACF;AAAA,AAxHA,KAAK,eAAe,AAAC,uCACb,EAAC,GAAE,CAAG,UAAS,AAAD,CAAG;AAAC,YA+Gc,YAAW,IAhHnD,eAAc,KAAO,cAC4B;EAAC,CAAC,CAAC,CAAC;AAwHrD","file":"angular2/src/render/dom/compiler/compile_element.js","sourcesContent":["import {List, Map, ListWrapper, MapWrapper} from 'angular2/src/facade/collection';\nimport {DOM} from 'angular2/src/dom/dom_adapter';\nimport {int, isBlank, isPresent, Type, StringJoiner, assertionsEnabled} from 'angular2/src/facade/lang';\n\nimport {ProtoViewBuilder, ElementBinderBuilder} from '../view/proto_view_builder';\n\n/**\n * Collects all data that is needed to process an element\n * in the compile process. Fields are filled\n * by the CompileSteps starting out with the pure HTMLElement.\n */\nexport class CompileElement {\n  element;\n  _attrs:Map;\n  _classList:List;\n  isViewRoot:boolean;\n  inheritedProtoView:ProtoViewBuilder;\n  distanceToInheritedBinder:number;\n  inheritedElementBinder:ElementBinderBuilder;\n  compileChildren: boolean;\n  elementDescription: string; // e.g. '<div [class]=\"foo\">' : used to provide context in case of error\n\n  constructor(element, compilationUnit = '') {\n    this.element = element;\n    this._attrs = null;\n    this._classList = null;\n    this.isViewRoot = false;\n    // inherited down to children if they don't have\n    // an own protoView\n    this.inheritedProtoView = null;\n    // inherited down to children if they don't have\n    // an own elementBinder\n    this.inheritedElementBinder = null;\n    this.distanceToInheritedBinder = 0;\n    this.compileChildren = true;\n    // description is calculated here as compilation steps may change the element\n    var tplDesc = assertionsEnabled()? getElementDescription(element) : null;\n    if (compilationUnit !== '') {\n      this.elementDescription = compilationUnit;\n      if (isPresent(tplDesc)) this.elementDescription += \": \" + tplDesc;\n    } else {\n      this.elementDescription = tplDesc;\n    }\n  }\n\n  isBound() {\n    return isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0;\n  }\n\n  bindElement() {\n    if (!this.isBound()) {\n      var parentBinder = this.inheritedElementBinder;\n      this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription);\n      if (isPresent(parentBinder)) {\n        this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder);\n      }\n      this.distanceToInheritedBinder = 0;\n    }\n    return this.inheritedElementBinder;\n  }\n\n  refreshAttrs() {\n    this._attrs = null;\n  }\n\n  attrs():Map<string,string> {\n    if (isBlank(this._attrs)) {\n      this._attrs = DOM.attributeMap(this.element);\n    }\n    return this._attrs;\n  }\n\n  refreshClassList() {\n    this._classList = null;\n  }\n\n  classList():List<string> {\n    if (isBlank(this._classList)) {\n      this._classList = ListWrapper.create();\n      var elClassList = DOM.classList(this.element);\n      for (var i = 0; i < elClassList.length; i++) {\n        ListWrapper.push(this._classList, elClassList[i]);\n      }\n    }\n    return this._classList;\n  }\n\n}\n\n// return an HTML representation of an element start tag - without its content\n// this is used to give contextual information in case of errors\nfunction getElementDescription(domElement):string {\n  var buf = new StringJoiner();\n  var atts = DOM.attributeMap(domElement);\n\n  buf.add(\"<\");\n  buf.add(DOM.tagName(domElement).toLowerCase());\n\n  // show id and class first to ease element identification\n  addDescriptionAttribute(buf, \"id\", MapWrapper.get(atts, \"id\"));\n  addDescriptionAttribute(buf, \"class\", MapWrapper.get(atts, \"class\"));\n  MapWrapper.forEach(atts, (attValue, attName) => {\n      if (attName !== \"id\" && attName !== \"class\") {\n          addDescriptionAttribute(buf, attName, attValue);\n      }\n  });\n\n  buf.add(\">\");\n  return buf.toString();\n}\n\n\nfunction addDescriptionAttribute(buffer:StringJoiner, attName:string, attValue) {\n  if (isPresent(attValue)) {\n      if (attValue.length === 0) {\n          buffer.add(' ' + attName);\n      } else {\n          buffer.add(' ' + attName + '=\"' + attValue + '\"');\n      }\n  }\n}\n"]}