Comments (11)
I'm all for removing 👍 For some directives, components/directive tags don't make sense at all (e.g. wp-bind
and friends).
I see value in using directive tags for components that are only rendered in the browser (e.g., a hypothetical
<wp-graph type="column">
that renders a complex graph component and doesn't need server-side rendering).
My 2 cents: YAGNI 😬 If it's only hypothetical, we don't necessarily need to accommodate for it yet; we can (re-)introduce the concept of a tag directive if/when we feel we actually need it.
maybe we can just talk about directives, instead of directive attributes
I'm all for that.
If we follow that path and later add the directive tags again, I think we'll not be able to name them "directives". 😅
I wouldn't rule that out! We could later introduce them saying that in addition to the previous directives, which were all attributes, we're adding directives that are tags/components themselves; to differentiate them, we'll refer to them as "tag directives", and to the "other" ones as "attribute directives". I think it's sometimes necessary to give an existing notion new meaning; that's fine, as long as we differentiate clearly.
from block-interactivity-experiments.
Thanks, folks.
Let's consider this decision taken and remove the directive tags/components from the code. I leave this issue open until it is done, but I'll move it to the pending tasks.
from block-interactivity-experiments.
No @luisherranz I guess it doesn't, and you're right. It's the presence of attribute directives that share a prefix with tag directives that prevents any speedups, but two prefixes for the same system for potential optimization seems unreasonable.
Long-term, if the goal is Core adoption, then special-casing is probably necessary anyway. The Tag Processor could expose $p->next_tag( array( 'contains_directive' => true ) )
and we could avoid the get_attribute_names_with_prefix()
silliness that clones attribute names and returns an array only for us to check if it's empty.
from block-interactivity-experiments.
Thanks for opening this discussion 🙂 It makes sense to me! If they don't add value, the fewer concepts we add, the better. If we remove directive tags, maybe we can just talk about directives, instead of directive attributes. This way, it should be easier to explain and understand.
from block-interactivity-experiments.
maybe we can just talk about directives, instead of directive attributes
I'd also love to hear opinions about this.
from block-interactivity-experiments.
I see value in using directive tags for components that are only rendered in the browser (e.g., a hypothetical <wp-graph type="column">
that renders a complex graph component and doesn't need server-side rendering).
Having said so, you can certainly use a "directive attribute" for that as well (e.g., <div wp-graph="column">
) with the only consideration that you would probably have to pass custom props using data-*
attributes.
maybe we can just talk about directives, instead of directive attributes
If we follow that path and later add the directive tags again, I think we'll not be able to name them "directives". 😅
from block-interactivity-experiments.
Hard to suggest not removing unnecessary complexity, but worth also noting that directive tags in general are faster to find than directive attributes. Practically speaking, the consequences here are probably something like needing to eventually special-case directives the Tag Processor in Core to support it.
For now it's all a wash, this is just an historical note.
from block-interactivity-experiments.
Does it matter if we have to add directive attributes anyway?
EDIT: it's not a rhetorical question
from block-interactivity-experiments.
@luisherranz I confirmed that Safari, Firefox, and Chrome all requested the images that were under a display: none
div.
from block-interactivity-experiments.
I confirmed that Safari, Firefox, and Chrome all requested the images that were under a display: none div.
I confirmed that <template>
doesn't, but I think this is the wrong issue, isn't it? 😄
from block-interactivity-experiments.
Solved in #217.
from block-interactivity-experiments.
Related Issues (20)
- Decide if we want to expose some parts of the router and/or other configuration in the store HOT 10
- Hydrate islands inside templates HOT 1
- Explore how to integrate the new View Transitions API HOT 2
- Add `data-wp-key` attribute HOT 1
- Fallback to server navigation when fetching on the client navigation fails HOT 2
- Gutenberg repo draft PR - Try: Dynamic text autocompleter PR HOT 3
- Refs are not passed correctly to directive callbacks
- Router: cancel navigation when another starts
- Router: keep favicon when doing client-side navigation
- Helper function for adding data-wp-context in PHP HOT 12
- Router: support hash
- Relative URLs in cached CSS files are not properly resolved HOT 2
- Helper functions for selectors/actions
- Support multisite with subdirectories in `navigate` function HOT 5
- Using useRef/wp-ref to get a reference to the DOM element HOT 4
- Potential JS overhead for URLs or sites that use just 1-2 simple interactivity features HOT 3
- `useSignalEffect` is not working as expected when using `visibility: hidden/visible` in CSS animations HOT 4
- Rename `data-wp-island` to `data-wp-interactive` HOT 2
- Preact fails to reconcile scripts correctly when doing client-side navigation. HOT 4
- The Interactivity API issues/discussions have been moved to Gutenberg
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from block-interactivity-experiments.