mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
add DOMTokenList polyfill (ad-hoc: directly in g-component)
This commit is contained in:
@@ -11,6 +11,27 @@ license that can be found in the LICENSE file.
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
|
// polyfill for DOMTokenList features: list of classes in add/remove;
|
||||||
|
// enable method.
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
var add = DOMTokenList.prototype.add;
|
||||||
|
var remove = DOMTokenList.prototype.remove;
|
||||||
|
DOMTokenList.prototype.add = function() {
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
add.call(this, arguments[i]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
DOMTokenList.prototype.remove = function() {
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
remove.call(this, arguments[i]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
DOMTokenList.prototype.enable = function(name, value) {
|
||||||
|
value ? this.add(name) : this.remove(name);
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
(function(){
|
(function(){
|
||||||
var bindAttrs = function(inAttrs) {
|
var bindAttrs = function(inAttrs) {
|
||||||
inAttrs.forEach(function(a) {
|
inAttrs.forEach(function(a) {
|
||||||
|
|||||||
Reference in New Issue
Block a user