Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rowspan and colspan not cleared #3997

Merged
merged 1 commit into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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