Skip to content

Commit

Permalink
Merge pull request #3997 from preactjs/fix-rowspan-colspan
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed May 9, 2023
2 parents b114dcc + 47fdd38 commit fadadde
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 @@ -117,6 +117,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 @@ -414,6 +414,48 @@ describe('render()', () => {
});
}

// 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);
});

// Test for preactjs/preact#651
it('should set enumerable boolean attribute', () => {
render(<input spellcheck={false} />, scratch);
Expand Down

0 comments on commit fadadde

Please sign in to comment.