Clone @default options object before merging it

This commit is contained in:
Mickele Moriconi 2012-02-28 13:12:46 +01:00
parent 8d6cb3ee8e
commit d059c3acaf
3 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ class Morris.Line
if not (this instanceof Morris.Line)
return new Morris.Line(options)
@el = $ document.getElementById(options.element)
@options = $.extend @defaults, options
@options = $.extend $.extend({}, @defaults), options
# bail if there's no data
if @options.data is undefined or @options.data.length is 0
return

View File

@ -8,7 +8,7 @@
function Line(options) {
if (!(this instanceof Morris.Line)) return new Morris.Line(options);
this.el = $(document.getElementById(options.element));
this.options = $.extend(this.defaults, options);
this.options = $.extend($.extend({}, this.defaults), options);
if (this.options.data === void 0 || this.options.data.length === 0) return;
this.el.addClass('graph-initialised');
this.precalc();

2
morris.min.js vendored

File diff suppressed because one or more lines are too long