Repository navigation
Description
This year, we're going all-in on stripping down Ember to its bare essentials.
The first target in that effort is making jQuery optional, so applications that aren't using jQuery don't need to include the bulk. Successfully making jQuery optional cuts out around 30kb of minified/gzipped code, so it's a very juicy target (it's around 15-20% of the total size of an Ember app's initial vendor.js!)
@rwjblue has done a lot of work so far on this front, and as of 28da357, the ember-application package tests clean without jQuery. Now it's time to finish the job.
Testing Ember
If this is your first time working on Ember, you should follow these steps:
- Make sure you're on the latest version of Node or the latest LTS of Node
- Update to the latest version of Yarn
- Clone https://github.com/emberjs/ember.js.git
- Run
yarnto populate yournode_modules - Run
yarn start - Go to
http://localhost:4200/tests/index.html?hidepassedin your browser. - Edit packages in your editor and refresh the browser. Rinse, repeat.
Testing Ember Without jQuery
To test Ember without jQuery, you add in the jquery=none query parameter when running tests.
If you do that, you'll get a bunch of failures, so we're working on removing the dependency on jQuery one package at a time.
To test a single package without jQuery, run the tests by hitting this URL:
http://localhost:4200/tests/index.html?hidepassed&jquery=none&package=ember-glimmer
Making Progress
In order to make progress on removing the jQuery dependency, you need to satisfy two criteria:
- Fewer tests fail in
jquery=nonemode - No tests fail without
jquery=none
Making progress in this way means that incremental work can always be merged into master, because there are no regressions when using Ember the way it's always been used.
Current Status and Work Items
I (@wycats) got the ember-glimmer package down to 20 failing tests on the no-jquery branch of https://github.com/wycats/ember.js.
However, I violated Rule 2 under "making progress" and broke a bunch of tests when running jQuery.
So some things you could work on:
- Getting the tests passing again in normal mode in
ember-glimmer - Getting any remaining tests passing with
jquery=noneinember-glimmer - Get tests passing without jQuery
- ember
- component_context_test.js - 3 failing
- link_to_test.js - 2 failing
- multiple-app-test.js - 1 failing
- reexports_test.js - 1 failing
- basic_test.js - 38 failing
- query_params_test.js - 23 failing
- ember-application (@rwjblue)
- ember-console
- ember-debug
- ember-extension-support
- ember-glimmer (@ro0gr )
- ember-metal
- ember-routing
- ember-runtime
- ember-template-compiler (@ro0gr)
- ember-testing (@snewcomer)
- ember-utils
- ember-views
- internal-test-helpers
- ember
- Switch packages to run in CI without jQuery (see f71bbd0 for an example)
- ember
- ember-application
- ember-console
- ember-debug
- ember-extension-support
- ember-glimmer
- ember-metal
- ember-routing
- ember-runtime
- ember-template-compiler
- ember-testing
- ember-utils
- ember-views (not tested at the moment)
- internal-test-helpers
- RFC to allow users to opt out of jQuery (to make sure people not using jQuery get good errors if they or an addon try)
- Write it (@simonihmig / @rwjblue)
- Merge it
- Make sure that error messages are good if people try to rely on jQuery features when jQuery is disabled
-
this.$()in Ember Components - pending requests in the test helpers (@rwjblue, does this work a different way with the new test helpers?)
- Anything else?
-
- Write an "opting out of jQuery" guide (like a deprecation guide, except jQuery is not deprecated yet) @emberjs/learning-team-managers
Not blockers for shipping the flag, but stuff we should work on before considering this feature "done":
- Figure out how to strip out all the extraneous noise of all of the jQuery imports in no-jQuery mode
- Signify on Ember Observer that an addon does not depends on jQuery - 🔒 @kategengler
Hang Out in Community Slack
We'll be coordinating this work on the community slack. You can join the #dev-jquery-removal channel.
Activity
wycats commentedon Jan 5, 2018
If you want to help get my branch passing in normal mode, follow the same instructions for contributions, but target https://github.com/wycats/ember.js/tree/no-jquery
topaxi commentedon Jan 5, 2018
I'm not sure if this matters at all, but if you want access to https://github.com/topaxi/ember-jquery and it's npm package or even move it somewhere please contact me :)
wycats commentedon Jan 5, 2018
@topaxi what does that package do right now?
I assume you're thinking we can use it to let people opt into the original functionality?
wycats commentedon Jan 5, 2018
I'm actively working on getting my own branch passing again.
alexander-alvarez commentedon Jan 5, 2018
I took a look through and
ember-debug&ember-consolehave no references to jQueryro0gr commentedon Jan 5, 2018
I've checked all the packages w/ and w/o
jquery. Here are packages that pass:ro0gr commentedon Jan 5, 2018
I would like to pick
ember-routingpackagerwjblue commentedon Jan 5, 2018
Once we get a package passing, it should be "locked" down in the
lib/packages.jsso that CI runs it both with and without jQuery.See f71bbd0 for where this was initially setup...
acorncom commentedon Jan 6, 2018
Looks like
ember-viewsandinternal-test-helperscan be switched over to run in CI without jQuery. I've added a separate todo for ensuring all these packages are locked downEdit: was looking at an older version of the
packages.jsfile, we're down to four moduleswycats commentedon Jan 6, 2018
@acorncom woot woot
wycats commentedon Jan 6, 2018
I got the tests passing on my branch, but for some reason tests are failing in IE11.
I'm off for the evening, but I'd love a PR to get things passing on IE11. If nobody tackles it, I'll try to wrap it up later this weekend 😄
RobbieTheWagner commentedon Jan 7, 2018
Anything I can help with? 😄
wycats commentedon Jan 7, 2018
@rwwagner90 do you think you can take a look at the IE11 bug on my branch?
1 remaining item
topaxi commentedon Jan 7, 2018
@wycats ember-jquery just includes jquery into the vendor bundle (it also allows for including the slim version
jquery-sliminstead of the full jquery build).Yes, it was my thought that it might be used for opt-in to the old behavior.
RobbieTheWagner commentedon Jan 7, 2018
@wycats is it just the browserstack failures you wanted me to look at? It seems that the first 4 jobs are failing on Travis, but not sure if they are related.
I tried running the browserstack tests locally, but couldn't seem to get it to work. Would you recommend setting up a VM for IE? I don't generally test in IE.
kategengler commentedon Jan 7, 2018
@rwwagner90 (and others looking to test other browsers), Microsoft provides virtual machines for testing Edge & IE https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
rwjblue commentedon Jan 8, 2018
Just landed the ember-glimmer changes that @wycats has been working on, and unlocked the
ember-glimmerpackage above.Anyone have time to pick up where @wycats left off and push
ember-glimmerwithout jQuery over the finish line?wycats commentedon Jan 8, 2018
@rwjblue @snewcomer what do we need to do to land #16075 ?
RobbieTheWagner commentedon Jan 10, 2018
@rwjblue still looking for help with ember-glimmer? I've never looked at the code there, but I can try to help 😄
wycats commentedon Jan 10, 2018
@rwwagner90 looks like @ro0gr finished it here: #16096
Confirming!
ro0gr commentedon Jan 10, 2018
@rwwagner90 @wycats yes,
ember-glimmeris finished. The only remaining package isember. I've took a brief looks there.There are quite many failures. Most of them are straightforward to fix. However I think it might make sense to decouple.
wycats commentedon Jan 10, 2018
@ro0gr decouple in what way?
ro0gr commentedon Jan 10, 2018
@wycats I think to decouple per file is good enough. If somebody wants to do all in once he still can.
Here is the current state of
emberpackage withjquerydisabled:wycats commentedon Jan 11, 2018
@ro0gr thanks! I updated it!
wycats commentedon Jan 15, 2018
@emberjs/learning-team-managers there will be some additional instructions for Ember Data:
warp-drive-data/warp-drive#5320 (comment)
wycats commentedon Jan 15, 2018
Is there anything left on the error message front?
simonihmig commentedon Jan 12, 2019
I would think this can be closed?