Permalink
Browse files

fix(Component): Changed boundAttrubutes setter to work with named att…

…ributes with no values eg: 'disabled' or 'required' for Component inputs
  • Loading branch information...
calebdwilliams committed Jul 19, 2018
1 parent af449a5 commit de8af6f493904e5b52cb7da208fe77cc9665edd9
@@ -463,7 +463,7 @@ class Component extends HTMLElement {
return this.getAttribute(attr);
},
set(_attr) {
if (_attr) {
if (_attr || attr === '') {
this.setAttribute(attr, _attr);
} else {
this.removeAttribute(attr);
@@ -472,7 +472,6 @@ class Component extends HTMLElement {
this[this.constructor.renderer]();
}
attrs.add(attr);

}
});
});
@@ -508,6 +507,8 @@ class Component extends HTMLElement {
attributeChangedCallback(name, oldValue, newValue) {
if (oldValue !== newValue) {
this[name] = newValue;
} else if (newValue === '' && this.hasAttribute(name)) {
this[name] = true;
}
}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -459,7 +459,7 @@ class Component extends HTMLElement {
return this.getAttribute(attr);
},
set(_attr) {
if (_attr) {
if (_attr || attr === '') {
this.setAttribute(attr, _attr);
} else {
this.removeAttribute(attr);
@@ -468,7 +468,6 @@ class Component extends HTMLElement {
this[this.constructor.renderer]();
}
attrs.add(attr);

}
});
});
@@ -504,6 +503,8 @@ class Component extends HTMLElement {
attributeChangedCallback(name, oldValue, newValue) {
if (oldValue !== newValue) {
this[name] = newValue;
} else if (newValue === '' && this.hasAttribute(name)) {
this[name] = true;
}
}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -462,7 +462,7 @@ class Component extends HTMLElement {
return this.getAttribute(attr);
},
set(_attr) {
if (_attr) {
if (_attr || attr === '') {
this.setAttribute(attr, _attr);
} else {
this.removeAttribute(attr);
@@ -471,7 +471,6 @@ class Component extends HTMLElement {
this[this.constructor.renderer]();
}
attrs.add(attr);

}
});
});
@@ -507,6 +506,8 @@ class Component extends HTMLElement {
attributeChangedCallback(name, oldValue, newValue) {
if (oldValue !== newValue) {
this[name] = newValue;
} else if (newValue === '' && this.hasAttribute(name)) {
this[name] = true;
}
}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -465,7 +465,7 @@ class Component extends HTMLElement {
return this.getAttribute(attr);
},
set(_attr) {
if (_attr) {
if (_attr || attr === '') {
this.setAttribute(attr, _attr);
} else {
this.removeAttribute(attr);
@@ -474,7 +474,6 @@ class Component extends HTMLElement {
this[this.constructor.renderer]();
}
attrs.add(attr);

}
});
});
@@ -510,6 +509,8 @@ class Component extends HTMLElement {
attributeChangedCallback(name, oldValue, newValue) {
if (oldValue !== newValue) {
this[name] = newValue;
} else if (newValue === '' && this.hasAttribute(name)) {
this[name] = true;
}
}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -64,7 +64,7 @@ export class Component extends HTMLElement {
return this.getAttribute(attr);
},
set(_attr) {
if (_attr) {
if (_attr || attr === '') {
this.setAttribute(attr, _attr);
} else {
this.removeAttribute(attr);
@@ -73,7 +73,6 @@ export class Component extends HTMLElement {
this[this.constructor.renderer]();
}
attrs.add(attr);

}
});
});
@@ -109,6 +108,8 @@ export class Component extends HTMLElement {
attributeChangedCallback(name, oldValue, newValue) {
if (oldValue !== newValue) {
this[name] = newValue;
} else if (newValue === '' && this.hasAttribute(name)) {
this[name] = true;
}
}

0 comments on commit de8af6f

Please sign in to comment.