Skip to content

Commit

Permalink
fix extraneous 'remove' attribute hook call.
Browse files Browse the repository at this point in the history
  • Loading branch information
botandrose-machine committed Dec 17, 2024
1 parent 4721e95 commit da7ade6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/idiomorph.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,10 @@ var Idiomorph = (function () {
// iterate backwards to avoid skipping over items when a delete occurs
for (let i = toAttributes.length - 1; 0 <= i; i--) {
const toAttribute = toAttributes[i];
if (ignoreAttribute(toAttribute.name, toEl, 'remove', ctx)) {
continue;
}
if (!fromEl.hasAttribute(toAttribute.name)) {
if (ignoreAttribute(toAttribute.name, toEl, 'remove', ctx)) {
continue;
}
toEl.removeAttribute(toAttribute.name);
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe("lifecycle hooks", function(){
calls.should.eql(["<li>B</li>"]);
});

it.skip('calls beforeAttributeUpdated when an attribute is added', function(){
it('calls beforeAttributeUpdated when an attribute is added', function(){
let calls = [];
let initial = make("<a></a>");
Idiomorph.morph(initial, `<a href="#"></a>`, { callbacks: {
Expand All @@ -127,7 +127,7 @@ describe("lifecycle hooks", function(){
calls.should.eql([["href", `<a></a>`, "update"]]);
});

it.skip('calls beforeAttributeUpdated when an attribute is updated', function(){
it('calls beforeAttributeUpdated when an attribute is updated', function(){
let calls = [];
let initial = make(`<a href="a"></a>`);
Idiomorph.morph(initial, `<a href="b"></a>`, { callbacks: {
Expand Down

0 comments on commit da7ade6

Please sign in to comment.