-
-
Notifications
You must be signed in to change notification settings - Fork 402
fix: acknowledge self-closing flag on foreign integration points #2492
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -338,6 +338,25 @@ export class Parser implements Callbacks { | |||||||
| return this.foreignContext[0] !== ForeignContext.None; | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Whether the element currently being opened is a foreign (SVG/MathML) | ||||||||
| * element. Foreign elements acknowledge the self-closing flag even in HTML | ||||||||
| * mode. | ||||||||
| * | ||||||||
| * HTML integration points (e.g. `<foreignObject>`, or `<title>` inside | ||||||||
| * `<svg>`) switch their *children* back to the HTML context, so | ||||||||
| * `isInForeignContext()` reports `false` for them even though the element | ||||||||
| * itself is foreign. For those, check the enclosing context instead. | ||||||||
| */ | ||||||||
| private currentTagIsForeign(): boolean { | ||||||||
| return ( | ||||||||
| this.isInForeignContext() || | ||||||||
| (this.htmlMode && | ||||||||
| htmlIntegrationElements.has(this.tagname) && | ||||||||
| this.foreignContext[1] !== ForeignContext.None) | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: The Prompt for AI agents
Suggested change
|
||||||||
| ); | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Checks if the current tag is a void element. Override this if you want | ||||||||
| * to specify your own additional void elements. | ||||||||
|
|
@@ -503,7 +522,7 @@ export class Parser implements Callbacks { | |||||||
| */ | ||||||||
| onselfclosingtag(endIndex: number): void { | ||||||||
| this.endIndex = endIndex; | ||||||||
| if (this.recognizeSelfClosing || this.isInForeignContext()) { | ||||||||
| if (this.recognizeSelfClosing || this.currentTagIsForeign()) { | ||||||||
| this.closeCurrentTag(false); | ||||||||
|
|
||||||||
| // Set `startIndex` for next node | ||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.