mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #21 from sjmiles/master
"DOMTokenList.enable" was renamed to "toggle" at platform, update polyfill
This commit is contained in:
@@ -18,7 +18,7 @@ license that can be found in the LICENSE file.
|
||||
};
|
||||
|
||||
// polyfill for DOMTokenList features: list of classes in add/remove;
|
||||
// enable method.
|
||||
// toggle method.
|
||||
(function() {
|
||||
'use strict';
|
||||
var add = DOMTokenList.prototype.add;
|
||||
@@ -33,7 +33,10 @@ license that can be found in the LICENSE file.
|
||||
remove.call(this, arguments[i]);
|
||||
}
|
||||
};
|
||||
DOMTokenList.prototype.enable = function(name, value) {
|
||||
DOMTokenList.prototype.toggle = function(name, value) {
|
||||
if (value == undefined) {
|
||||
value = !this.contains(name);
|
||||
}
|
||||
value ? this.add(name) : this.remove(name);
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
this.$.icon.src = this.src;
|
||||
},
|
||||
activeChanged: function() {
|
||||
this.classList.enable('selected', this.active);
|
||||
this.classList.toggle('selected', this.active);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
prototype: {
|
||||
valueAttributeChanged: function() {
|
||||
for (var i=0, s; s=this.stars[i]; i++) {
|
||||
s.classList.enable('full', i < Number(this.value));
|
||||
s.classList.toggle('full', i < Number(this.value));
|
||||
}
|
||||
},
|
||||
clickHandler: function(e) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
this.component({
|
||||
prototype: {
|
||||
verticalChanged: function() {
|
||||
this.classList.enable('vertical', this.vertical);
|
||||
this.classList.toggle('vertical', this.vertical);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
this.component({
|
||||
prototype: {
|
||||
valueChanged: function() {
|
||||
this.$.toggle.classList.enable('on', this.value);
|
||||
this.$.toggle.classList.toggle('on', this.value);
|
||||
},
|
||||
toggle: function() {
|
||||
this.value = !this.value;
|
||||
|
||||
Reference in New Issue
Block a user