J
James Padolsey
james.padolsey.com · Personal blog · on HN since 2009
James Padolsey is a London JavaScript developer who writes about jQuery, browser quirks and code quality, and built a jQuery source viewer.
What HN saysHN commenters link his jQuery source viewer as a quick way to see how a method works, and discuss his views on avoiding jQuery.
43HN people shared it
11linked it in comments
52stories submitted
377story points
10 years agolast shared
2009people per year2026
Most-shared posts
- 1JQuery source viewer8 people · 6 points · first shared 2011 · discussion on HN
- 2How to deal with bad code3 people · 7 points · first shared 2013 · discussion on HN
- 3Detect IE in JavaScript without User-Agent sniffing3 people · 3 points · first shared 2010 · discussion on HN
- 4“prettyPrint” is an in-browser JavaScript “variable dumper”2 people · 38 points · first shared 2009 · 7 comments on HN
- 5jQuery Lint2 people · 34 points · first shared 2010 · discussion on HN
- 6Things you may not know about jQuery2 people · 28 points · first shared 2009 · 4 comments on HN
- 7Replacing text in the DOM… solved?1 people · 79 points · first shared 2012 · 16 comments on HN
- 8JS Adolescence: Change of opinion regarding certain JavaScript practices1 people · 39 points · first shared 2012 · 19 comments on HN
- 9Functionless event handlers in jQuery1 people · 24 points · first shared 2009 · 6 comments on HN
- 10JQuery source explorer1 people · 24 points · first shared 2010 · 3 comments on HN
- 11JQuery Code Smells1 people · 13 points · first shared 2010 · 26 comments on HN
- 12What JS devs seem to care about1 people · 11 points · first shared 2012 · 4 comments on HN
- 13Introducing: JSHTML1 people · 11 points · first shared 2009 · 8 comments on HN
- 14Partial loop unrolling in JavaScript1 people · 6 points · first shared 2010 · 3 comments on HN
- 15Fuzzy Scoring Regex Mayhem1 people · 5 points · first shared 2015 · discussion on HN
What HN people wrote when they linked it
padolsey · 2013-05-01
SEEKING WORK, London, Remote
Skill set - JavaScript, HTML5, CSS3, jQuery, MooTools, Underscore/lodash, Backbone, AngularJS, Canvas, SVG
CV: http://padolsey.net/cv/cv.pdf
Github: http://github.com/padolsey
Website: http://james.padolsey.com
thisisblurry · 2011-06-02
Also worth taking a look at: http://james.padolsey.com/jquery/
It lets you quickly view how a particular jQuery function/method works.
WickyNilliams · 2014-01-30
You do realise zepto works in IE10+ only, and even then you need an additional module for support. I wouldn't say it's worthwhile. It is not a viable alternative.
I'm working on a widget that other people will embed on their page. I cannot make assumptions about jQuery being available and I cannot afford to add jQuery as a dependency. Assuming the widget was valuable to you, would you want to add my widget to your page if it included 94kb (jQuery 1.10.2 minified) of JS before my code was even added on top? If you cared about performance, it's highly unlikely you would.
So for that reason I've been working with plain JS for months now. We have browser support back to IE9 (maybe even 8), and our entire codebase is around 25kb minified (gzipped < 6kb). We have one or two collections of utilities, but most of it is application code that would still be there even if we had jQuery as a dependency. All I can say is it is not that big a problem. If you're not sure how to get something to work across browsers, look at the source of jQuery (this website [0] is fantastic for this purpose) or any other library that is well regarded.
But you know what? Most of the time it isn't even a problem. And with modern tools [1][2] and a good test suite, it's not difficult testing across multiple browsers to quickly find issues.
Before even working on this project I decided to go on a self-administered "jQuery diet". I haven't used jQuery in any personal projects [3][4] for at least a year and…
imjared · 2013-05-20
Author makes some points that are fine, I guess. A dev needs to carefully consider his audience and his fellow developers. If I can use jQuery and know that I'm not going to have cross-browser DOM API issues, then let me have it. Because the method simply doesn't work in older browsers (<IE8 http://caniuse.com/#search=queryselectorall) It's not entirely fair to say that `$(".my-class li:first-child")` is equal to `document.querySelectorAll(".my-class li:first-child")` or that `$('.my-class')` is equivalent to `document.getElementsByClassName('my-class')` (doesn't work in <IE9 http://caniuse.com/#search=getelementsbyclassname).
If you're building games or working with a team who does, I'm going to guess you're working with fairly edge functionality in browsers where javascript support is great. If you're building sites for clients who are still (sigh) using IE7 internally, you just can't get away with something quite so simple.
As another commenter mentioned:
"Even the most avid follower of JS updates can't compete with a team of the standard jQuery draws upon. When a new method gets rolled in to the core of jQuery, something that speeds up selectors for example, your code improves without you doing any work."
This is the same reason I use a library for preprocessing my CSS. I'd rather update a gem and trust a team whose focus is processing CSS than try to rely on myself for keeping up to date with the pace of the CSS WG and browser vendors.
Also, for anyone wanting to…
MichaelApproved · 2016-03-27
! -> "not truthy". So !! means "not 'not truthy'" which is truthy.
Truthy is something that isn't exactly a true boolean but will equate to true(thy) when evaluated with this type of comparison. Things like undefined, null, and empty string will not be truthy.
More info on what's truthy (for JavaScript at least) is here http://james.padolsey.com/javascript/truthy-falsey/
edit: typically, if you want to test for truthy, you'll just evaluate it like so
if (my_object) {
//truthy
}else{
//not truthy
}
Does anyone know a time when you'd use !! instead of just the object in the evaluation? I'm not a Ruby dev, so I don't know specific cases for needing !!
wanda · 2015-04-19
This just in: abstractions are slower to process, faster to develop.
It's not like this has been true of high-level programming languages for decades...
Even jQuery's harmfulness has been discussed for years[1][2] as well as that of other front-end frameworks Angular[3].
Just like high-level programming languages, the goal of abstractions is not to achieve better performance, but to enable faster development time with less expertise, which most firms figure translates to more profit in less time.
-----------
[1]: https://jsperf.com/jquery-selectors-vs-native-api
[2]: http://james.padolsey.com/general/javascript-abstractions
[3]: http://jsperf.com/angular-foreach-vs-native-for-loop
niyazpk · 2013-12-29
This one supports the latest (and older) versions of jQuery - http://james.padolsey.com/jquery/
_delirium · 2013-11-08
Two solutions that do something smarter than just global search/replace on the raw HTML:
http://net.tutsplus.com/tutorials/javascript-ajax/spotlight-jquery-rep…
http://james.padolsey.com/javascript/find-and-replace-text-with-javasc…
TeMPOraL · 2013-09-13
I use http://james.padolsey.com/javascript/prettyprint-for-javascript/ at work in a debugging interface for AJAX requests. Sometimes having JSON pretty-printed in the sidebar is more convenient than clicking on it to expand it in the console.
mcs · 2012-12-04
One of the things i've recently built has an infinite scrolly feed of items, and http://airbnb.github.com/infinity/ is what I ended up using after using Masonry for a long time.
Edit: along with Scroll Events http://james.padolsey.com/demos/scrollevents/
scottjehl · 2011-02-07
I'd imagine that's the IE check's fault. I can switch it over to James Padolsey's check to see if that helps. (http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional…