This issue was originally filed by off...@mikemitterer.at
What steps will reproduce the problem?
pull little sample app from email@example.com:MikeMitterer/SampleEventHandling.git
Open the html-File with Fireforx or Chrom - not with Chromium
Click on "Dart rocks" - works
Click on "JQuery rolls" - it fails
Open the Developer Tools in Chrome and you'll see the error message:
Uncaught TypeError: Cannot call method 'apply' of undefined
What is the expected output? What do you see instead?
It's expected that "Dart rocks" add a dot to the 17 and "JQuery rolls" should add
add a ~ to the numer but only the Dart-Part works.
What version of the product are you using? On what operating system?
Version 0.1.0.201203152021, Build 5549
Dart SDK version 5549, Dartium version
Please provide any additional information below.
The currious thing it that it works in Chromium
screenshot-976.jpg (149.71 KB)
Please unassign if this is not an IO lib issue. Possibly assign to Dart2JS then?
Added Area-UI, Triaged labels.
This comment was originally written by off...@mikemitterer.at
OK, you are right. It's probably Dart2JS. Are you forwarding this ticket to Dart2JS or do I have to do that?
I ran into this bug again trying to get js.dart + jQuery to work together: https://github.com/dart-lang/js-interop/issues/21
Refiled on dart2js. It appears that both dart2js generated code and jquery use a global '$' symbol in incompatible ways.
Removed Area-UI label.
Added Area-Dart2JS label.
Added this to the Later milestone.
Issue #6853 has been merged into this issue.
This comment was originally written by shyc2...@gmail.com
I get both dart2js and jQuery working by calling jQuery.noConflict(). It releases the $ symbol which is causing the conflict.
Then I declare "var $ = jQuery;" as local variable, and the jQuery code after that works fine for me.
This comment was originally written by theme...@gmail.com
Will this issue be fixed in dart2js? It's annoying when use libraries depend on jQuery,
I cannot put "var $ = jQuery;" int libraries every time.
Added TriageForM5 label.
Removed this from the Later milestone.
Added this to the M5 milestone.
Removed TriageForM5 label.
We should definitely try to avoid introducing global names.
For possible work arounds, take a look at: http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/
Some of the techniques suggested in that document could also be used by dart2js.
Removed this from the M5 milestone.
Added this to the Later milestone.
I needed to clean up how we access $ in some helper methods, so I added an option to control the name of $ to help me test it.
https://codereview.chromium.org/16135004 adds option --global-js-name to dart2js.
Added Started label.
Fixed in r23391.
Added Fixed label.
This comment was originally written by kholbr...@sonardesign.com
This is still a problem with the build from 23799.
Is is fixed to not abuse "$" or just to have the work-around flag?
This is a serious problem, please fix correctly by not abusing "$".
kholbrook, what is, in your opinion, a correct fix?
Do not abuse "$".
Developers world-wide use jQuery, which everyone knows uses "$".
There is no reason dart2js can not put the generated code in a global with a name specific to Dart. This is exactly what we are all forced to do to make it work. Forcing a default that causes serious compatibility problems is not the correct approach. Not to mention being forced to use the work-around flag means you are forced out of the editor and having to use the command-line to invoke dart2js, since the editor does not support options for dart2js invocation. This breaks workflow, this breaks compatibility. This is just plain wrong.
Ideally, dart2js should generate code wrapped in something like this:
Unfortunately, we discovered that this had an adverse effect on performance. Fortunately, the V8 team has since been working on fixing this issue, and we hope to be able to completely eliminate the use of global variables.
For now, offering an option is the best we can do.
In the interim, would it be possible to make the default "$dart"?