Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
trigger native dom events
JavaScript
Branch: patch-1
Pull request Compare This branch is 13 commits behind adamsanderson:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
Makefile
Readme.md
component.json
index.js

Readme.md

trigger-event

Trigger native DOM events. This is primarily useful for testing, or for triggering common DOM events such as the change event for custom components.

Installation

component install adamsanderson/trigger-event

See component for more information.

API

trigger(el, name, options)

Triggers the name event on el. Options may be passed in to customize the event.

HTMLEvents support the following options:

bubbles
cancelable

MouseEvents support the following options:

bubbles
cancelable
detail (number of clicks)
screenX / screenY
clientX / clientY
ctrlKey
altKey
shiftKey
metaKey
button (mouse button)

See the W3C Event Spec for more details.

Where sensible, sane defaults will be filled in. See the list of event types for supported events.

Attribution

This is loosely based on kangax's event.simulate.js.

License

MIT


Adam Sanderson - http://monkeyandcrow.com

Something went wrong with that request. Please try again.