Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c29caa3

Browse filesBrowse files
authored
Merge pull request #4375 from preactjs/debug/tr-warning
debug: Disallow <tr> as a child of <table>
2 parents 414c870 + cfc80bf commit c29caa3
Copy full SHA for c29caa3

File tree

Expand file treeCollapse file tree

2 files changed

+31
-26
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+31
-26
lines changed

‎debug/src/debug.js

Copy file name to clipboardExpand all lines: debug/src/debug.js
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,10 @@ export function initDebug() {
387387
type === 'tr' &&
388388
domParentName !== 'thead' &&
389389
domParentName !== 'tfoot' &&
390-
domParentName !== 'tbody' &&
391-
domParentName !== 'table'
390+
domParentName !== 'tbody'
392391
) {
393392
console.error(
394-
'Improper nesting of table. Your <tr> should have a <thead/tbody/tfoot/table> parent.' +
393+
'Improper nesting of table. Your <tr> should have a <thead/tbody/tfoot> parent.' +
395394
serializeVNode(vnode) +
396395
`\n\n${getOwnerStack(vnode)}`
397396
);

‎debug/test/browser/debug.test.js

Copy file name to clipboardExpand all lines: debug/test/browser/debug.test.js
+29-23Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -543,12 +543,14 @@ describe('debug', () => {
543543
it('Accepts minimal well formed table', () => {
544544
const Table = () => (
545545
<table>
546-
<tr>
547-
<th>Head</th>
548-
</tr>
549-
<tr>
550-
<td>Body</td>
551-
</tr>
546+
<tbody>
547+
<tr>
548+
<th>Head</th>
549+
</tr>
550+
<tr>
551+
<td>Body</td>
552+
</tr>
553+
</tbody>
552554
</table>
553555
);
554556
render(<Table />, scratch);
@@ -586,23 +588,27 @@ describe('debug', () => {
586588
it('accepts valid nested tables', () => {
587589
const Table = () => (
588590
<table>
589-
<tr>
590-
<th>foo</th>
591-
</tr>
592-
<tr>
593-
<td id="nested">
594-
<table>
595-
<tr>
596-
<td>cell1</td>
597-
<td>cell2</td>
598-
<td>cell3</td>
599-
</tr>
600-
</table>
601-
</td>
602-
</tr>
603-
<tr>
604-
<td>bar</td>
605-
</tr>
591+
<tbody>
592+
<tr>
593+
<th>foo</th>
594+
</tr>
595+
<tr>
596+
<td id="nested">
597+
<table>
598+
<tbody>
599+
<tr>
600+
<td>cell1</td>
601+
<td>cell2</td>
602+
<td>cell3</td>
603+
</tr>
604+
</tbody>
605+
</table>
606+
</td>
607+
</tr>
608+
<tr>
609+
<td>bar</td>
610+
</tr>
611+
</tbody>
606612
</table>
607613
);
608614

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.