Replace the call to bind with a call to on.

This commit is contained in:
Michael Miller 2018-09-20 10:26:15 -05:00
parent 14530d0733
commit 39cf68f93e
4 changed files with 14 additions and 10 deletions

View File

@ -58,6 +58,10 @@ tests currently *only* pass on OS X.
## Changelog
### 0.5.2 - 20th September 2018
- Replace calls to the jQuery.bind method with jQuery.on to give jQuery 3.0.0 support.
### 0.5.1 - 15th June 2014
- Fix touch event handling.

View File

@ -48,7 +48,7 @@ class Morris.Donut extends Morris.EventEmitter
@raphael = new Raphael(@el[0])
if @options.resize
$(window).bind 'resize', (evt) =>
$(window).on 'resize', (evt) =>
if @timeoutId?
window.clearTimeout @timeoutId
@timeoutId = window.setTimeout @resizeHandler, 100

View File

@ -39,7 +39,7 @@ class Morris.Grid extends Morris.EventEmitter
@setData @options.data
# hover
@el.bind 'mousemove', (evt) =>
@el.on 'mousemove', (evt) =>
offset = @el.offset()
x = evt.pageX - offset.left
if @selectFrom
@ -50,18 +50,18 @@ class Morris.Grid extends Morris.EventEmitter
else
@fire 'hovermove', x, evt.pageY - offset.top
@el.bind 'mouseleave', (evt) =>
@el.on 'mouseleave', (evt) =>
if @selectFrom
@selectionRect.hide()
@selectFrom = null
@fire 'hoverout'
@el.bind 'touchstart touchmove touchend', (evt) =>
@el.on 'touchstart touchmove touchend', (evt) =>
touch = evt.originalEvent.touches[0] or evt.originalEvent.changedTouches[0]
offset = @el.offset()
@fire 'hovermove', touch.pageX - offset.left, touch.pageY - offset.top
@el.bind 'click', (evt) =>
@el.on 'click', (evt) =>
offset = @el.offset()
@fire 'gridclick', evt.pageX - offset.left, evt.pageY - offset.top
@ -71,17 +71,17 @@ class Morris.Grid extends Morris.EventEmitter
.toBack()
.hide()
@el.bind 'mousedown', (evt) =>
@el.on 'mousedown', (evt) =>
offset = @el.offset()
@startRange evt.pageX - offset.left
@el.bind 'mouseup', (evt) =>
@el.on 'mouseup', (evt) =>
offset = @el.offset()
@endRange evt.pageX - offset.left
@fire 'hovermove', evt.pageX - offset.left, evt.pageY - offset.top
if @options.resize
$(window).bind 'resize', (evt) =>
$(window).on 'resize', (evt) =>
if @timeoutId?
window.clearTimeout @timeoutId
@timeoutId = window.setTimeout @resizeHandler, 100

4
morris.min.js vendored

File diff suppressed because one or more lines are too long