Hacker News new | ask | show | jobs
by simion314 2327 days ago
OK, I will try to calm our discussion down.

The .css() function can be used as a getter or setter , so if you do something like

el.css('font-size') it will not only do the inline style check as your example, if that is missing it can get the computed css style. Also if you check the MDN page https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement... you will see that IE is mentioned because it is a bit different in behavior.

So here is what I see as facts, let me know what fact is wrong and why

- pure JS most of the time you need more lines of code to do the same thing, more lines makes the code less readable

- pure JS does not chain nicely as jQuery, the code is such less elegant and harder to read

- to solve the above you probably consider writing your own mini jQuery, your version will probably be smaller but it will probably miss corner cases and your code will be harder to read for other developers.

You are probably imagine I am wrinting some horible jQuery code to create complex web pages, I am not using it like that(I think React is something that would fit complex GUIs and server side templates in any language for simple stuff ). The problem I am solving is this: the input is any html from the web, fill with garbage and broken tags, I need to do something like "Reader mode" to clean it up (I use the Moziila library for this) but add some more cleanup on top, then I need to transform it in a more strict version of html because my output needs to pass some validator, so I need to find and remove illegal elements/attributes duplicated IDs, fix different garbage ... ideally all the garbage is removed and you get pure text and images, only P,span and img tags (it is more complicated). I also want to present the result on screen and let the user customize some styling.

For new simple project pure JS is enough, for more complex SPA you probably want a framework, there might be some cases where jQuery can work fine, maybe server side rendering where you need a bit of JS for small interactivity (not on SPA) also there are still some good jQuerry UI widgets around,

Can you tell me where is the anti-jQuery sentiment is coming from and if you feel the same for lodash or similar helper libraries?

Sorry for my language I am not as good as others with some of english weird syntax and is harder to write my thoughts