Skip to content

Commit

Permalink
Fix WebReflection#358 - Cleanup accessors before dropping the attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
WebReflection committed May 10, 2019
1 parent 9f98c42 commit 6262e1d
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
11 changes: 6 additions & 5 deletions cjs/objects/Updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,13 @@ Tagger.prototype = {
return newValue => {
if (oldValue !== newValue) {
oldValue = newValue;
if (node[name] !== newValue) {
node[name] = newValue;
if (newValue == null) {
node.removeAttribute(name);
}
if (node[name] !== newValue && newValue == null) {
// cleanup on null to avoid silly IE/Edge bug
node[name] = '';
node.removeAttribute(name);
}
else
node[name] = newValue;
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion esm.js

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions esm/objects/Updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,13 @@ Tagger.prototype = {
return newValue => {
if (oldValue !== newValue) {
oldValue = newValue;
if (node[name] !== newValue) {
node[name] = newValue;
if (newValue == null) {
node.removeAttribute(name);
}
if (node[name] !== newValue && newValue == null) {
// cleanup on null to avoid silly IE/Edge bug
node[name] = '';
node.removeAttribute(name);
}
else
node[name] = newValue;
}
};
}
Expand Down
12 changes: 5 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1549,13 +1549,11 @@ var hyperHTML = (function (document) {
if (oldValue !== newValue) {
oldValue = newValue;

if (node[name] !== newValue) {
node[name] = newValue;

if (newValue == null) {
node.removeAttribute(name);
}
}
if (node[name] !== newValue && newValue == null) {
// cleanup on null to avoid silly IE/Edge bug
node[name] = '';
node.removeAttribute(name);
} else node[name] = newValue;
}
};
} else if (name in Intent.attributes) {
Expand Down
2 changes: 1 addition & 1 deletion min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions test/edge.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<title>Edge test</title>
<script>document.write('<script src="../index.js?_=' + Math.random() + '"><' + '/script>')</script>
<script>
this.onload = () => {
hyperHTML.adopt(document.body)`<div><ul></ul>${'OK'}<hr></div>`;
this.onload = function () {
hyperHTML.bind(document.body)(['<textarea rows="3" value="', '"/>'], null);
};
</script>
</head>
<body><div><ul></ul>NO<hr></div></body>
<body></body>
</html>
2 changes: 1 addition & 1 deletion umd.js

Large diffs are not rendered by default.

0 comments on commit 6262e1d

Please sign in to comment.