Open Roboe opened 7 years ago
As long as it doesn't break compatibility with newest Firefox and newest Chrome it's fine with me. I just hacked this extension together yesterday in maybe an hour so I wasn't too interested in making the code nice (and without jQuery)
(and wtf is this pre-defined "good first issue" label 😆 )
I wasn't too interested in making the code nice (and without jQuery)
Sure, understandable, it was only a hacky thing
The "good first issue" label has the sense to attract other developers to start collaborating in the project. They are usually simple, non-critical issues to make contact, :)
Since jQuery is a massive library just to get some little utility functions, and it's furthermore considered legacy code, it may be an improvement to rely only in those native JavaScript interfaces that where created with the things jQuery teached to webdeveloping in mind.
jQuery element selector (
$('CSS selector')
) could be replaced with<node>.querySelectorAll('CSS selector')
calls. Documentation on MDN This is a quite simple replacement, IMO: one line at the top of the script (var $ = document.querySelectorAll.bind(document)
) and... done. No need to rewrite calls.querySelectorAll()
over thedocument
object (which is a node), and apply the arguments passed to the function toquerySelectorAll
. Remember that JS has powerfull functional language features, ;)The resource requesting
jQuery.get()
could be replaced with the Fetch API. Since WebExtensions are newer than the Fetch API, no compatibility issue takes account. Documentation of the Fetch API on MDNOf course this is only an optional improvement. It can be done to learn some basic JavaScript modern techniques, for example.