Skip to content
This repository was archived by the owner on Sep 24, 2019. It is now read-only.

Remove the jQuery dependency #100

Closed
3 tasks done
fredck opened this issue Dec 17, 2013 · 7 comments
Closed
3 tasks done

Remove the jQuery dependency #100

fredck opened this issue Dec 17, 2013 · 7 comments

Comments

@fredck
Copy link

fredck commented Dec 17, 2013

Steps to complete this issue

  • Replace the current jQuery default build with a custom build that does not include transition
  • animations and other behaviors that we don't use.
  • Refactor the :quailCss pseudo-selector, among other non-standard jQuery selectors like :has, :input.
    Replace jQuery whole-cloth with smaller, focused

Description

Being QUAIL a generic js library, wouldn’t it be better to remove the jQuery dependency out of it?

jQuery is a 93KB file and in fact QUAIL is using just a small part of it. Actually, the most use for it is the CSS selector stuff and a few tools, like each().

There are several CSS selectors libs out. Sizzle is the most obvious option, but there are even more compact solutions. In fact, QUAIL is not using ultra-complex selectors and eventually a simpler lib would do the job as well. Still Sizzle would be better with 1/5 of jQuery's size.

As for the tools, that’s just js programming style. Still, if some tools are needed, it is enough to decouple the small bits of source code from jQuery or any other js lib out there, having only the stuff that is really needed.

As for jQuery, it would still be possible to the make QUAIL a plugin for it. This would add just a few bits of code to QUAIL.

Anyway, I’m actually just opening a discussion here, to check if it makes any sense investigating it further. Thanks!

@kevee
Copy link
Collaborator

kevee commented Dec 17, 2013

Moving to a more agnostic library was always the plan, and I think we have made the first big step in decoupling the core and component code from the plugin wrapper. Another request was to make quail play well with cheerio, where again the differences are minor but a few things need to be tweaked to make it work.

@kevee
Copy link
Collaborator

kevee commented Dec 18, 2013

I just did an audit of all the jQuery-specific code, and beside simple selector/transversal and $.each, we also use $.ajax to fetch test definitions, as well as JSON APIs (like asking YouTube if a video has subtitles).

@srounce
Copy link

srounce commented May 6, 2014

So, what happened with this? It doesn't appear to have been excised from the project dependencies.

@mlewand
Copy link
Member

mlewand commented Jul 17, 2015

@srounce In fact it wasn't removed, I'll reopen this issue to continue discussion.

@fredck As for selector engine, don't really even need to use Sizzle here. Ideally we would like to use Element.querySelectorAll.

To sum current arguments and add few more:

  • reviewing jQuery code, gives us a better chances to spot some problems (like sync ajax calls, that was the most severe for us Use async $.ajax call to load tests json #332, Remove synchornous AJAX requests cksource/quail#16)
  • initially I thought that selector performance won't change so much, but when I took :quailCss pseudo-class selector, and transformed it to use native DOM operations - execution time was reduced 4 times (actually it was 4.8x so it was even closer to 5)
  • code size will be reduced a lot

@mlewand mlewand reopened this Jul 17, 2015
@jessebeach
Copy link
Member

From our call on July 23rd, 2015:

We'll take a phased approach to removing jQuery.

  1. Replace the current jQuery default build with a custom build that does not include transition, animations and other behaviors that we don't use.
  2. Refactor the :quailCss pseudo-selector, among other non-standard jQuery selectors like :has, :input.
  3. Replace jQuery whole-cloth with smaller, focused

@jessebeach
Copy link
Member

Ok, I think we can finally achieve this in the master branch.

@jessebeach
Copy link
Member

jQuery is out.

I've put a build process in place that runs the code through Babel for transpiling.

#390

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants