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

feat(parser): Support search element #452

Merged
merged 3 commits into from
Mar 24, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/parse5/lib/common/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export enum TAG_NAMES {

S = 's',
SCRIPT = 'script',
SEARCH = 'search',
SECTION = 'section',
SELECT = 'select',
SOURCE = 'source',
Expand Down Expand Up @@ -292,6 +293,7 @@ export enum TAG_ID {

S,
SCRIPT,
SEARCH,
SECTION,
SELECT,
SOURCE,
Expand Down Expand Up @@ -423,6 +425,7 @@ const TAG_NAME_TO_ID = new Map<string, TAG_ID>([
[TAG_NAMES.RUBY, TAG_ID.RUBY],
[TAG_NAMES.S, TAG_ID.S],
[TAG_NAMES.SCRIPT, TAG_ID.SCRIPT],
[TAG_NAMES.SEARCH, TAG_ID.SEARCH],
[TAG_NAMES.SECTION, TAG_ID.SECTION],
[TAG_NAMES.SELECT, TAG_ID.SELECT],
[TAG_NAMES.SOURCE, TAG_ID.SOURCE],
Expand Down
1 change: 0 additions & 1 deletion packages/parse5/lib/parser/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ generateParsingTests(
{
withoutErrors: true,
suitePath: new URL('../../../../test/data/html5lib-tests/tree-construction', import.meta.url),
expectErrors: ['0.search-element', '1.search-element'],
},
(test, opts) => ({
node: test.fragmentContext ? parseFragment(test.fragmentContext, test.input, opts) : parse(test.input, opts),
Expand Down
2 changes: 2 additions & 0 deletions packages/parse5/lib/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2253,6 +2253,7 @@ function startTagInBody<T extends TreeAdapterTypeMap>(p: Parser<T>, token: TagTo
case $.DETAILS:
case $.ADDRESS:
case $.ARTICLE:
case $.SEARCH:
case $.SECTION:
case $.SUMMARY:
case $.FIELDSET:
Expand Down Expand Up @@ -2583,6 +2584,7 @@ function endTagInBody<T extends TreeAdapterTypeMap>(p: Parser<T>, token: TagToke
case $.ADDRESS:
case $.ARTICLE:
case $.DETAILS:
case $.SEARCH:
case $.SECTION:
case $.SUMMARY:
case $.LISTING:
Expand Down