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

Conditional writing of markup to output #31

Merged
merged 3 commits into from
May 2, 2024

Conversation

egil
Copy link
Owner

@egil egil commented May 2, 2024

This PR adds the IConditionalOutputComponent type, which influences how the renderer will generate/write markup to the output during a request.

Here are the rules:

  1. If a component does NOT implement IConditionalOutputComponent, nor any of its parents, it will always generate markup.
  2. If a component does NOT implement IConditionalOutputComponent, but a parent component does, then it's closest parent decides whether or not to generate markup.
  3. If a component implements IConditionalOutputComponent, it decides whether or not it should generate markup. It may also decide this for it's children, if they do not implement IConditionalOutputComponent.

This PR also includes a few changes to the default behavior of Htmxor:

  1. If a component does not include a @attribute [HxLayout(typeof(MyOwnHxLayout)], then it will be assigned the HtmxorLayoutComponentBase by default. This component does NOT generate any markup IF it has one or more children that has implements IConditionalOutputComponent.

@egil egil force-pushed the feature/fragment-template-rendering branch from edf5795 to 8e82c60 Compare May 2, 2024 19:58
@egil egil merged commit 28b37a1 into main May 2, 2024
6 checks passed
@egil egil deleted the feature/fragment-template-rendering branch May 2, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant