diff --git a/src/diff/index.js b/src/diff/index.js index 88557ff0860..7e57b6c301a 100644 --- a/src/diff/index.js +++ b/src/diff/index.js @@ -240,7 +240,7 @@ function diffElementNodes(dom, newVNode, oldVNode, context, isSvg, excessDomChil if (oldProps === EMPTY_OBJ) { oldProps = {}; for (let i=0; i { test('3'); test(null); - expect(scratch.innerHTML).to.equal('
', 'for null'); + expect(scratch.innerHTML).to.equal('
', 'for null'); test('4'); test(undefined); - expect(scratch.innerHTML).to.equal('
', 'for undefined'); + expect(scratch.innerHTML).to.equal('
', 'for undefined'); }); } @@ -481,7 +481,7 @@ describe('render()', () => { ); render(, scratch); - expect(scratch.innerHTML).to.equal('
Bye
'); + expect(scratch.innerHTML).to.equal('
Bye
'); }); it('should remove class attributes', () => { @@ -495,7 +495,7 @@ describe('render()', () => { expect(scratch.innerHTML).to.equal('
Bye
'); render(, scratch); - expect(scratch.innerHTML).to.equal('
Bye
'); + expect(scratch.innerHTML).to.equal('
Bye
'); }); it('should remove old styles', () => { @@ -1017,6 +1017,13 @@ describe('render()', () => { expect(scratch.innerHTML).to.equal('
foo
'); }); + it('should remove old attributes that are undefined', () => { + render(, scratch); + render(, scratch); + + expect(scratch.firstElementChild.hasAttribute('href')).to.be.false; + }); + // see preact/#1327 it('should not reuse unkeyed components', () => { class X extends Component {