diff --git a/externs/closure-types.js b/externs/closure-types.js index 0cabb51658..5159c4d1c2 100644 --- a/externs/closure-types.js +++ b/externs/closure-types.js @@ -1374,4 +1374,19 @@ Polymer_ArraySelectorMixin.prototype.select = function(item){}; * @param {number} idx Index from `items` array to select * @return {void} */ -Polymer_ArraySelectorMixin.prototype.selectIndex = function(idx){}; \ No newline at end of file +Polymer_ArraySelectorMixin.prototype.selectIndex = function(idx){}; +/** +* @interface +* @extends {Polymer_PropertyEffects} +*/ +function Polymer_AttributeCapitalization(){} +/** +* @override +* @param {Node} node Node to parse +* @param {TemplateInfo} templateInfo Template metadata for current template +* @param {NodeInfo} nodeInfo Node metadata for current template node +* @param {*} name +* @param {*} value +* @return {boolean} +*/ +Polymer_AttributeCapitalization._parseTemplateNodeAttribute = function(node, templateInfo, nodeInfo, name, value){}; \ No newline at end of file diff --git a/lib/utils/attribute-capitalization-mixin.html b/lib/utils/attribute-capitalization-mixin.html new file mode 100644 index 0000000000..d3d856789d --- /dev/null +++ b/lib/utils/attribute-capitalization-mixin.html @@ -0,0 +1,80 @@ + + + + + + diff --git a/test/unit/attribute-capitalization.html b/test/unit/attribute-capitalization.html new file mode 100644 index 0000000000..f7927a822f --- /dev/null +++ b/test/unit/attribute-capitalization.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + diff --git a/types/lib/utils/attribute-capitalization-mixin.d.ts b/types/lib/utils/attribute-capitalization-mixin.d.ts new file mode 100644 index 0000000000..0188ffeb3e --- /dev/null +++ b/types/lib/utils/attribute-capitalization-mixin.d.ts @@ -0,0 +1,47 @@ +/** + * DO NOT EDIT + * + * This file was automatically generated by + * https://github.com/Polymer/gen-typescript-declarations + * + * To modify these typings, edit the source file(s): + * lib/utils/attribute-capitalization-mixin.html + */ + +/// +/// +/// + +declare namespace Polymer { + + + /** + * Mixin that uses an heuristic to determine the capitalization of HTML + * attributes. By default, all attributes are lowercased. However, some + * native attributes have capitalization. `Element.attributes` only returns + * capitalized attributes if the attribute name is exactly equal to the attribute. + * In other words, `viewBox$` will be lowercased to `viewbox$`. Therefore, if + * an attribute name still has capitaliation, we use an attribute effect to + * update the bindings. + */ + function AttributeCapitalization {}>(base: T): T & AttributeCapitalizationConstructor & Polymer.PropertyEffectsConstructor & Polymer.TemplateStampConstructor & Polymer.PropertyAccessorsConstructor & Polymer.PropertiesChangedConstructor; + + interface AttributeCapitalizationConstructor { + new(...args: any[]): AttributeCapitalization; + + /** + * Overrides default `PropertyEffects` implementation to automatically + * detect capitalized attributes. + * + * @param node Node to parse + * @param templateInfo Template metadata for current template + * @param nodeInfo Node metadata for current template node + * @returns `true` if the visited node added node-specific + * metadata to `nodeInfo` + */ + _parseTemplateNodeAttribute(node: Node|null, templateInfo: TemplateInfo|null, nodeInfo: NodeInfo|null, name: any, value: any): boolean; + } + + interface AttributeCapitalization { + } +}