Trumbowyg: Remove jQuery dependency?

Created on 7 Sep 2016  路  15Comments  路  Source: Alex-D/Trumbowyg

Just wondering, in the light of this post, how difficult it would be to remove the dependency on jQuery.

enhancement request

Most helpful comment

I recommend Axios as an option for XHR requests. It's the standard library AJAX requests for Vue, which I also use. (Trumbowyg is one of the few non-Vue components I still use, and the only one that depends on JQuery.)

All 15 comments

If I remove jQuery (and it should be possible in v3) I will rewrite the plugin and do not base Trumbowyg on buggy execCommand.

I know that is not possible/hard yet to remove the dependency on jQuery :/

@Alex-D Have you thought about replacing jQuery with something like cash? It seems to cover most of what jQuery does but at a fraction of the size. I believe around 3kb~ gzipped.

Would this be a difficult task?

There is no AJAX support, so it's hard yep :/

You're right... Although there is a pull request on the repository that we could try to give a little shove... I may be bias, but I love this WYSIWYG editor and I would love it even more if I didn't have to require jquery due to its size... Let me know of you need any help, I wouldn't mind contributing.

@SmoshySmosh 馃憤
@Alex-D is this only the line 177? Or are there more problems? Because a request is also pretty simple in VanillaJS. I would also help, because this would made this WYSIWYG editor more awesome! And save loading time 馃槒

Because a request is also pretty simple in VanillaJS

I know. I'm not fan of jQuery anymore. But if the ajax support could be supported by cash it could be cool. Upload plugin use it too.

@Alex-D sorry what I meant, was not to switch from one library to another, I would recommend to use Vanilla JS or better say pure JS. Without any use of extra library. I think this should also work?! 馃槒

I know what Vanilla JS is. But XHR Requests are not so easy to support on each browsers, especially IE/Edge :(

I believe we have a few options for XHR, remember the goal is to keep the final size down.

https://github.com/pyrsmk/qwest - 2.2kb
https://github.com/dimitrinicolas/marmottajax - 1.8kb
https://github.com/typicode/fetchival - 0.6kb

Thoughts?

@Alex-D 馃憤
@SmoshySmosh fetchival looks great and close to this, what I would have in mind.

I recommend Axios as an option for XHR requests. It's the standard library AJAX requests for Vue, which I also use. (Trumbowyg is one of the few non-Vue components I still use, and the only one that depends on JQuery.)

@Alex-D if you need any help with anything let me know

Axios and axios.all() is nice, but I like the minimal size of fetchival.

cash is also a nice small jQuery replacement.
Alternatives could be umbrellajs or maybe it's easier to move to zeptojs (compatible with some jquery methods, ajax,...)?

I plan to remove jQuery dependency in version 3.

See #875 for more details.

Was this page helpful?
0 / 5 - 0 ratings