DmitryBaranovskiy / g.raphael

Charts for Raphaël
http://g.raphaeljs.com/
1.52k stars 435 forks source link

Update g.raphael.js - add semicolon #201

Closed TobiasKrogh closed 2 years ago

TobiasKrogh commented 10 years ago

In my company we are merging several files into one. g.raphael.js comes immediately before g.line.js. Trying to evaluate the resulting file shows "TypeError: object is not a function" because first code line of g.line.js starts with "(". So the browser (at least current Chrome) tries to evaluate that together showing an error (of course). We did a monkey patch using ";" at the end of g.raphael.js (which anyway makes sense to end that code line) and do not experience problems any more.

Summarized code excerpt: (last object setup in g.raphael.js) //chart prototype for storing common functions Raphael.g = { //... }

(start of g.line.js) /*!

(function () {

=> so the browser tried to somehow eval "Raphael.g = {}(function() {" when we concatenated the files. At least that is the only thing I can imagine.

Cheers, Tobias Krogh