Skip to content

Commit

Permalink
backport #3997
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Jan 22, 2024
1 parent de40f9e commit 08a977f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/diff/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export function setProperty(dom, name, value, oldValue, isSvg) {
// cast to `0` instead
name !== 'tabIndex' &&
name !== 'download' &&
name !== 'rowSpan' &&
name !== 'colSpan' &&
name in dom
) {
try {
Expand Down
42 changes: 42 additions & 0 deletions test/browser/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1244,4 +1244,46 @@ describe('render()', () => {
expect(items[0]).to.have.property('parentNode').that.should.exist;
expect(items[1]).to.have.property('parentNode').that.should.exist;
});

// Test for #3969
it('should clear rowspan and colspan', () => {
let update;
class App extends Component {
constructor(props) {
super(props);
this.state = { active: true };
update = this.setState.bind(this);
}

render() {
return (
<div>
{this.state.active ? (
<table>
<tr>
<td rowSpan={2} colSpan={2}>
Foo
</td>
</tr>
</table>
) : (
<table>
<tr>
<td>Foo</td>
</tr>
</table>
)}
</div>
);
}
}

render(<App />, scratch);

update({ active: false });
rerender();

expect(scratch.querySelector('td[rowspan]')).to.equal(null);
expect(scratch.querySelector('td[colspan]')).to.equal(null);
});
});

0 comments on commit 08a977f

Please sign in to comment.