From d45dd5750c56bf1586e6c0b00ae89ab6015fa08f Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Wed, 28 Feb 2018 13:12:09 +0100 Subject: [PATCH] Put attribute capitalization fix in property-effects --- externs/closure-types.js | 17 +--- lib/mixins/property-effects.html | 7 +- lib/utils/attribute-capitalization-mixin.html | 80 ------------------- test/unit/attribute-capitalization.html | 58 -------------- test/unit/property-effects-elements.html | 22 +++++ test/unit/property-effects.html | 17 ++++ .../utils/attribute-capitalization-mixin.d.ts | 47 ----------- 7 files changed, 46 insertions(+), 202 deletions(-) delete mode 100644 lib/utils/attribute-capitalization-mixin.html delete mode 100644 test/unit/attribute-capitalization.html delete mode 100644 types/lib/utils/attribute-capitalization-mixin.d.ts diff --git a/externs/closure-types.js b/externs/closure-types.js index 5159c4d1c2..0cabb51658 100644 --- a/externs/closure-types.js +++ b/externs/closure-types.js @@ -1374,19 +1374,4 @@ Polymer_ArraySelectorMixin.prototype.select = function(item){}; * @param {number} idx Index from `items` array to select * @return {void} */ -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 +Polymer_ArraySelectorMixin.prototype.selectIndex = function(idx){}; \ No newline at end of file diff --git a/lib/mixins/property-effects.html b/lib/mixins/property-effects.html index 2afd52319e..cdcf0ed32a 100644 --- a/lib/mixins/property-effects.html +++ b/lib/mixins/property-effects.html @@ -43,6 +43,9 @@ READ_ONLY: '__readOnly' }; + /** @const {string} */ + const capitalAttributeRegex = /[A-Z]/; + /** * @typedef {{ * name: (string | undefined), @@ -2530,7 +2533,9 @@ // Attribute or property let origName = name; let kind = 'property'; - if (name[name.length-1] == '$') { + if (capitalAttributeRegex.test(name)) { + kind = 'attribute'; + } else if (name[name.length-1] == '$') { name = name.slice(0, -1); kind = 'attribute'; } diff --git a/lib/utils/attribute-capitalization-mixin.html b/lib/utils/attribute-capitalization-mixin.html deleted file mode 100644 index d3d856789d..0000000000 --- a/lib/utils/attribute-capitalization-mixin.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - diff --git a/test/unit/attribute-capitalization.html b/test/unit/attribute-capitalization.html deleted file mode 100644 index f7927a822f..0000000000 --- a/test/unit/attribute-capitalization.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/test/unit/property-effects-elements.html b/test/unit/property-effects-elements.html index aeeee70e43..ecfca10c0c 100644 --- a/test/unit/property-effects-elements.html +++ b/test/unit/property-effects-elements.html @@ -7,6 +7,8 @@ Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> + +