Re:Removing jQuery from GitHub.com frontend
by sbjs on Wednesday July 25, 2018 @06:51PM
(#17613650)
I kind of imagine we will one day have a basic poly fill for all the cross platform issues jQuery actually excels at, and then we truly won’t need jQuery since that’s all it’s really good at these days. Things like chaining are an anti pattern and lead to brittle code!
[ Parent
| on HN ]
Re:Removing jQuery from GitHub.com frontend
by Piskvorrr on Thursday July 26, 2018 @04:55AM
(#17616040)
Oh, but we already do have that, over there: https://jquery.com/
What's with the trend "jQ is old, old is bad! We need something that does the same thing, and most importantly is not named jQuery"?
Re:Removing jQuery from GitHub.com frontend
by AmericanChopper on Thursday July 26, 2018 @05:15AM
(#17616101)
Most DOM manipulation in jQuery goes through jQuery.globalEval, which uses eval(). Meaning if you want to have a CSP, you have to allow unsafe-eval if you need to support jQuery.
CSP is an incredibly useful tool, and it’s close to impossible to use it properly with jQuery.
First concrete, legitimate reason I've seen all thread. Is there something fundamental about jQuery's design that forces it to use eval(), or is it possible a new version could avoids that?
Re:Removing jQuery from GitHub.com frontend
by AmericanChopper on Thursday July 26, 2018 @07:49AM
(#17616681)
Performing evals is a core part of the design. Take a look at the additional notes section on this documentation of the .html method.
>By design, any jQuery constructor or method that accepts an HTML string — jQuery(), .append(), .after(), etc. — can potentially execute code
This makes jQuery less safe in general, but I think the CSP restrictions this puts in place are probably a greater issue for most people. I’ve been involved in retro-fitting strict CSPs into a few projects, and more than once I’ve been thwarted by very minor use of jQuery in a couple of places.
It's part of the design of the creation of new elements. But that's just one part of jQuery, and a part I would be completely okay with jQuery getting rid of.
Re:Removing jQuery from GitHub.com frontend
by emodendroket on Wednesday July 25, 2018 @09:38PM
(#17614471)
I don't think I can agree with that idea about chaining.
Re:Removing jQuery from GitHub.com frontend
by brailsafe on Wednesday July 25, 2018 @07:58PM
(#17614019)
I think those are some broad generalizations that I can't agree with, but Sizzle might be what you're looking for.
Re:Removing jQuery from GitHub.com frontend
by floatboth on Wednesday July 25, 2018 @08:07PM
(#17614073)
Sizzle is ancient history at this point. It's the selector engine jQuery used before querySelector became available everywhere.
Re:Removing jQuery from GitHub.com frontend
by brailsafe on Thursday July 26, 2018 @04:58AM
(#17616049)
Yes, that was the point. What did you think I thought Sizzle was?