|
|
|
|
|
by xionon
5039 days ago
|
|
"Useless" is subjective, but the jQuery object does a lot of extra work above the vanilla example. $ isn't just a syntax layer on top of querySelectorAll. When you do $('p'), it first queries the DOM for everything that matches that selector, then it creates new jQuery objects to wrap each of the returned nodes as well as creating a jQuery object to contain them. If all you're doing is setting the innerHTML of these objects, it's a non-trivial overhead. |
|
[1] https://github.com/jquery/jquery/blob/master/src/manipulatio...