10 * The name of the icon to use. The name should be of the form:
11 * `iconset_name:icon_name`.
15 observer
: '_iconChanged'
19 * The name of the theme to used, if one is specified by the
24 observer
: '_updateIcon'
28 * If using iron-icon without an iconset, you can set the src to be
29 * the URL of an individual icon image file. Note that this will take
30 * precedence over a given icon attribute.
34 observer
: '_srcChanged'
38 _DEFAULT_ICONSET
: 'icons',
40 _iconChanged: function(icon
) {
41 var parts
= (icon
|| '').split(':');
42 this._iconName
= parts
.pop();
43 this._iconsetName
= parts
.pop() || this._DEFAULT_ICONSET
;
47 _srcChanged: function(src
) {
51 _usesIconset: function() {
52 return this.icon
|| !this.src
;
55 _updateIcon: function() {
56 if (this._usesIconset()) {
57 if (this._iconsetName
) {
58 this._iconset
= this.$.meta
.byKey(this._iconsetName
);
60 this._iconset
.applyIcon(this, this._iconName
, this.theme
);
62 this._warn(this._logf('_updateIcon', 'could not find iconset `'
63 + this._iconsetName
+ '`, did you import the iconset?'));
68 this._img
= document
.createElement('img');
69 this._img
.style
.width
= '100%';
70 this._img
.style
.height
= '100%';
72 this._img
.src
= this.src
;
73 Polymer
.dom(this.root
).appendChild(this._img
);