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

Docs about stopping the Cascade #1576

Open
carstenjaksch opened this issue Dec 15, 2024 · 0 comments
Open

Docs about stopping the Cascade #1576

carstenjaksch opened this issue Dec 15, 2024 · 0 comments

Comments

@carstenjaksch
Copy link

Often partials use a param called class and are nested. In that case, I don't want to use the parent class data in a nested partial that doesn't receive class itself:

{{# The parent partial receives a class. #}}
{{ partial:parent class="some-class" }}
{{#
    @name Parent
    @param class Custom CSS classes.
#}}

{{# No class passed to the child. #}}
<div :$class>
    {{ partial:child }}
</div>
{{#
    @name Child
    @param class Custom CSS classes.
#}}

{{# Since class is null, the Cascade would look upwards until it finds class data. #}}
<div :$class>
    I am a child.
</div>

My solution here was to use view:class. The nested partial doesn't receive the parent's class data anymore. I don't know if this is the intended use case (besides that).

I would either add this as a "best practice" (like in the linked docs article) to the Data Inheritance docs page or another solution that might be better.

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

No branches or pull requests

1 participant