Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cto
g1
Commits
a6cfaa6a
Commit
a6cfaa6a
authored
Feb 03, 2018
by
S Anand
Browse files
DOC: $.dispatch() options
parent
e6d65925
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
a6cfaa6a
...
...
@@ -330,12 +330,16 @@ $('script[type="text/html"]')
## $.dispatch
Triggers a native JavaScript event. For example:
```
js
$
(
'
a.action
'
).
dispatch
(
'
click
'
)
```
mimics a user click action on
`a.action`
. Unlike
[
$.trigger
](
https://api.jquery.com/trigger/
)
,
this executes non-jQuery event handlers as well.
sends a click to
`a.action`
. Like
[
$.trigger
](
https://api.jquery.com/trigger/
)
,
but this will fire non-jQuery event handlers as well.
### $.dispatch options
You can add an optional dict as the second parameter. It can have any
[
event properties
](
https://developer.mozilla.org/en-US/docs/Web/API/Event#Properties
)
...
...
@@ -345,6 +349,12 @@ as attributes. For example:
$
(
'
a.action
'
).
dispatch
(
'
click
'
,
{
bubbles
:
true
,
cancelable
:
false
})
```
-
bubbles: whether the event bubbles or not. default: true
-
cancelable: whether the event is cancelable or not. default: true
-
All other
`new Event()`
options will also work
https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events
## L.TopoJSON
...
...
src/event.js
View file @
a6cfaa6a
/*
Usage: $(selector).dispatch(event, options)
Simulate the event on the selector.
$('a').dispatch('click')
$('input').dispatch('change')
Options
-------
- bubbles: whether the event bubbles or not. default: true
- cancelable: whether the event is cancelable or not. default: true
- All other `new Event()` options will also work
https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Creating_and_triggering_events
*/
var
_event
try
{
new
Event
(
'
click
'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment