v-once whitelist and additional directives
See original GitHub issueWhat problem does this feature solve?
If a single child of a v-once
parent requires reactivity then we can not use v-once
on the parent element but must apply it to all the siblings of the reactive element/component instead. It would be nicer if we could whitelist the reactive children of an element or component that has v-once
with some additional proposed directives.
Whitelists are usually a better strategy, especially for security, than blacklists.
What does the proposed API look like?
Ideally we would be able to do this:
<div v-once>
<h1>static text</h1>
<h1 v-exclude>{{non-static text}}</h1>
<h1>static text</h1>
<h1>static text</h1>
</div>
instead of the following:
<div>
<h1 v-once>static text</h1>
<h1>{{non-static text}}</h1>
<h1 v-once>static text</h1>
<h1 v-once>static text</h1>
</div>
Some additional directives proposed:
- v-always: takes precedent over
v-never
and always excludes an element/component and its children - v-never: takes precedent over
v-exclude
and never excludes an element/component and its children - v-exclude: exclude a specific element/component and its children from v-once
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
V Shred Email Whitelist Instructions
Enter the email address vince@vshred.com in the text box. Click "Add to list"; Vince will now be added to your list of "Safe...
Read more >Other provider – Whitelist Guide
Guide provides easy step-by-step instructions for updating safe sender or email white list settings for all the most popular email providers and we...
Read more >How to whitelist ip to a specific domain | Linode Questions
I have owncloud installed on my linode. I was wondering if it was possible to set an iptable rule to only allow my...
Read more >Pixellot Streaming Requirements for Windows Clients and ...
2) The tool does not factor in whitelisted domains and/or content ... In addition, please whitelist the REQUIRED domains in any active ...
Read more >CSP Is Dead, Long Live CSP! On the Insecurity of Whitelists ...
For additional directives to provide a meaningful security benefit, the site must first use a safe policy that success- fully prevents script ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
v-once
should really only be used on chunks of template that are significantly large and costly to render, otherwise the benefit would be negligible. Most applications perform perfectly fine without the need forv-once
at all. The cost of introducing these additional directives/concepts, both technical and API surface increase, are not really worth it.@posva See https://github.com/vuejs/vue/blob/dev/src/compiler/optimizer.js#L75, template below will generate static render function.
IMO the costs of implementing this feature is heavily outweigh its benefits.