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

Unified Diff: third_party/polymer/v1_0/components-chromium/iron-iconset-svg/iron-iconset-svg-extracted.js

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-chromium/iron-iconset-svg/iron-iconset-svg-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/iron-iconset-svg/iron-iconset-svg-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-iconset-svg/iron-iconset-svg-extracted.js
index 3f461e292235db6a2227d354ab78e664f441bcac..bbbf0997e504f0b4d10d362424c401d02b511b41 100644
--- a/third_party/polymer/v1_0/components-chromium/iron-iconset-svg/iron-iconset-svg-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/iron-iconset-svg/iron-iconset-svg-extracted.js
@@ -31,6 +31,7 @@
* iconset.applyIcon(iconNode, 'car');
*
* @element iron-iconset-svg
+ * @demo demo/index.html
*/
Polymer({
@@ -50,14 +51,6 @@
},
/**
- * 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
@@ -72,6 +65,18 @@
},
/**
+ * 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,
@@ -113,32 +118,17 @@
/**
*
- * 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,
@@ -160,6 +150,9 @@
* 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