Blazor messes up standard HTMLTemplateElement <template>#67660
Open
Vinoth2562000 wants to merge 2 commits into
Open
Blazor messes up standard HTMLTemplateElement <template>#67660Vinoth2562000 wants to merge 2 commits into
Vinoth2562000 wants to merge 2 commits into
Conversation
Contributor
|
Thanks for your PR, @Vinoth2562000. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blazor messes up standard HTMLTemplateElement
<template>Description
When content was rendered inside a
<template>tag (for example, through aRenderFragment), Blazor appended child nodes directly to the<template>element instead of its associatedcontentDocumentFragment. This behavior was not compliant with the HTML specification forHTMLTemplateElement, which requires all child content to be stored withintemplate.contentwhile the<template>element itself remains empty.To address this, the rendering logic in
LogicalElementshas been updated to recognizeHTMLTemplateElementinstances and correctly insert rendered content into the element'scontentDocumentFragment. This ensures that the generated DOM structure aligns with native browser behavior and the HTML specification.Before
After
Changes included
appendDomNodeinLogicalElements.tsto route DOM insertions through a container-resolution helper.getLogicalDomNodeContainer(parent)helper that resolves the correct DOM container for logical element operations:template.contentforHTMLTemplateElementinstances.HTMLTemplateElementhandling inLogicalElements.test.ts.Fixes #50831