Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace calls to the jQuery.bind method with jQuery.on to give jQuery 3.0.0 support. #772

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/morris.donut.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions lib/morris.grid.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions morris.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Licensed under the BSD-2-Clause License.
this.init();
}
this.setData(this.options.data);
this.el.bind('mousemove', function(evt) {
this.el.on('mousemove', function(evt) {
var left, offset, right, width, x;
offset = _this.el.offset();
x = evt.pageX - offset.left;
Expand All @@ -117,20 +117,20 @@ Licensed under the BSD-2-Clause License.
return _this.fire('hovermove', x, evt.pageY - offset.top);
}
});
this.el.bind('mouseleave', function(evt) {
this.el.on('mouseleave', function(evt) {
if (_this.selectFrom) {
_this.selectionRect.hide();
_this.selectFrom = null;
}
return _this.fire('hoverout');
});
this.el.bind('touchstart touchmove touchend', function(evt) {
this.el.on('touchstart touchmove touchend', function(evt) {
var offset, touch;
touch = evt.originalEvent.touches[0] || evt.originalEvent.changedTouches[0];
offset = _this.el.offset();
return _this.fire('hovermove', touch.pageX - offset.left, touch.pageY - offset.top);
});
this.el.bind('click', function(evt) {
this.el.on('click', function(evt) {
var offset;
offset = _this.el.offset();
return _this.fire('gridclick', evt.pageX - offset.left, evt.pageY - offset.top);
Expand All @@ -140,20 +140,20 @@ Licensed under the BSD-2-Clause License.
fill: this.options.rangeSelectColor,
stroke: false
}).toBack().hide();
this.el.bind('mousedown', function(evt) {
this.el.on('mousedown', function(evt) {
var offset;
offset = _this.el.offset();
return _this.startRange(evt.pageX - offset.left);
});
this.el.bind('mouseup', function(evt) {
this.el.on('mouseup', function(evt) {
var offset;
offset = _this.el.offset();
_this.endRange(evt.pageX - offset.left);
return _this.fire('hovermove', evt.pageX - offset.left, evt.pageY - offset.top);
});
}
if (this.options.resize) {
$(window).bind('resize', function(evt) {
$(window).on('resize', function(evt) {
if (_this.timeoutId != null) {
window.clearTimeout(_this.timeoutId);
}
Expand Down Expand Up @@ -1881,7 +1881,7 @@ Licensed under the BSD-2-Clause License.
}
this.raphael = new Raphael(this.el[0]);
if (this.options.resize) {
$(window).bind('resize', function(evt) {
$(window).on('resize', function(evt) {
if (_this.timeoutId != null) {
window.clearTimeout(_this.timeoutId);
}
Expand Down
4 changes: 2 additions & 2 deletions morris.min.js

Large diffs are not rendered by default.