Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Unified Diff: third_party/polymer/v1_0/components/iron-iconset-svg/iron-iconset-svg.html

Issue 1187823002: Update Polymer components and re-run reproduce.sh (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v1_0/components/iron-iconset-svg/iron-iconset-svg.html
diff --git a/third_party/polymer/v1_0/components/iron-iconset-svg/iron-iconset-svg.html b/third_party/polymer/v1_0/components/iron-iconset-svg/iron-iconset-svg.html
index 0c5977db2a08dd75fc207279aa599d1183920b66..485285716a22fc2f1949cda5867d6e9e95ef46ca 100644
--- a/third_party/polymer/v1_0/components/iron-iconset-svg/iron-iconset-svg.html
+++ b/third_party/polymer/v1_0/components/iron-iconset-svg/iron-iconset-svg.html
@@ -44,6 +44,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* iconset.applyIcon(iconNode, 'car');
*
* @element iron-iconset-svg
+ * @demo demo/index.html
*/
Polymer({
@@ -63,14 +64,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
},
/**
- * Array of fully-qualitifed icon names in the iconset.
- */
- iconNames: {
- type: Array,
- notify: true
- },
-
- /**
* The size of an individual icon. Note that icons must be square.
*
* @attribute iconSize
@@ -85,6 +78,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
},
/**
+ * Construct an array of all icon names in this iconset.
+ *
+ * @return {!Array} Array of icon names.
+ */
+ getIconNames: function() {
+ this._icons = this._createIconMap();
+ return Object.keys(this._icons).map(function(n) {
+ return this.name + ':' + n;
+ }, this);
+ },
+
+ /**
* Applies an icon to the given element.
*
* An svg icon is prepended to the element's shadowRoot if it exists,
@@ -126,32 +131,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
*
- * When name is changed, either register a new iconset with the included
- * icons, or if there are no children, set up a meta-iconset.
+ * When name is changed, register iconset metadata
*
*/
_nameChanged: function() {
new Polymer.IronMeta({type: 'iconset', key: this.name, value: this});
- // icons (descendents) must exist a-priori
- this._icons = this._createIconMap();
- this.iconNames = this._getIconNames();
- },
-
- /**
- * Array of all icon names in this iconset.
- *
- * @return {!Array} Array of icon names.
- */
- _getIconNames: function() {
- return Object.keys(this._icons).map(function(n) {
- return this.name + ':' + n;
- }, this);
},
/**
* Create a map of child SVG elements by id.
*
- * @return {Object} Map of id's to SVG elements.
+ * @return {!Object} Map of id's to SVG elements.
*/
_createIconMap: function() {
// Objects chained to Object.prototype (`{}`) have members. Specifically,
@@ -173,6 +163,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* matching `id`.
*/
_cloneIcon: function(id) {
+ // create the icon map on-demand, since the iconset itself has no discrete
+ // signal to know when it's children are fully parsed
+ this._icons = this._icons || this._createIconMap();
return this._prepareSvgClone(this._icons[id], this.size);
},

Powered by Google App Engine
This is Rietveld 408576698