You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Clarify event filter uses in hx-trigger
* Change hx-trigger event filter example to avoid ambiguity
input is both a tag and an event.
* Document the scope difference between standard selector and event filter
from:input listens to the page and click[event.target.matches('input')] listens to the element.
* Document that event filters as an alternative to CSS selectors require eval
* Move note about eval to standard event filters section.
* Simplify the referenced to standard event filters in the standard event modifiers section, and link to the standard event filters section instead.
* End quote in the correct place in standard event modifier doc.
* Correct language on how event filters from:body receive events.
* hx-trigger filter example catches click events specifically.
Copy file name to clipboardExpand all lines: www/content/attributes/hx-trigger.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ A standard event, such as `click` can be specified as the trigger like so:
20
20
#### Standard Event Filters
21
21
22
22
Events can be filtered by enclosing a boolean javascript expression in square brackets after the event name. If
23
-
this expression evaluates to `true` the event will be triggered, otherwise it will be ignored.
23
+
this expression evaluates to `true` the event will be triggered, otherwise it will be ignored. Standard event filters [require eval](@/docs.md#configuration-options).
@@ -56,7 +56,7 @@ is seen again it will reset the delay.
56
56
is seen again before the delay completes, it is ignored, the element will trigger at the end of the delay.
57
57
*`from:<Extended CSS selector>` - allows the event that triggers a request to come from another element in the document (e.g. listening to a key event on the body, to support hot keys)
58
58
* A standard CSS selector resolves to all elements matching that selector. Thus, `from:input` would listen on every input on the page.
59
-
* The CSS selector is only evaluated once and is not re-evaluated when the page changes. If you need to detect dynamically added elements use an event filter, for example `click[event.target.matches('input')]`
59
+
* The CSS selector is only evaluated once and is not re-evaluated when the page changes. If you need to detect dynamically added elements use a [standard event filter](#standard-event-filters), for example `hx-trigger="click[event.target.matches('button')] from:body"` which would [catch](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Event_bubbling) click events from every button on the page.
60
60
* The extended CSS selector here allows for the following non-standard CSS values:
0 commit comments