Skip to content

Commit

Permalink
Fix "Improper nesting of paragraph" for span under a paragraph (#4144)
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeaun authored Sep 29, 2023
1 parent 0c1b93c commit 08b07cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion debug/src/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ function isTableElement(type) {
}

const ILLEGAL_PARAGRAPH_CHILD_ELEMENTS =
/address|article|aside|blockquote|details|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|main|menu|nav|ol|p|pre|search|section|table|ul/;
/^(address|article|aside|blockquote|details|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|main|menu|nav|ol|p|pre|search|section|table|ul)$/;

const forceUpdate = Component.prototype.forceUpdate;
Component.prototype.forceUpdate = function (callback) {
Expand Down
11 changes: 11 additions & 0 deletions debug/test/browser/debug.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,17 @@ describe('debug', () => {
render(<Paragraph />, scratch);
expect(console.error).to.be.calledOnce;
});

it('should not warn for nesting span under a paragraph', () => {
const Paragraph = () => (
<p>
<span>Hello world</span>
</p>
);

render(<Paragraph />, scratch);
expect(console.error).to.not.be.called;
});
});

describe('PropTypes', () => {
Expand Down

0 comments on commit 08b07cc

Please sign in to comment.