Suspicion

I’ve already had some thoughtful responses to yesterday’s post about trust. I wrapped up my thoughts with a request:

I would love it if someone could explain why they avoid native browser features but use third-party code.

Chris obliged:

I can’t speak for the industry, but I have a guess. Third-party code (like the referenced Bootstrap and React) have a history of smoothing over significant cross-browser issues and providing better-than-browser ergonomic APIs. jQuery was created to smooth over cross-browser JavaScript problems. That’s trust.

Very true! jQuery is the canonical example of a library smoothing over the bumpy landscape of browser compatibilities. But jQuery is also the canonical example of a library we no longer need because the browsers have caught up …and those browsers support standards directly influenced by jQuery. That’s a library success story!

Charles Harries takes on my question in his post Libraries over browser features:

I think this perspective of trust has been hammered into developers over the past maybe like 5 years of JavaScript development based almost exclusively on inequality of browser feature support. Things are looking good in 2022; but as recently as 2019, 4 of the 5 top web developer needs had to do with browser compatibility.

Browser compatibility is one of the underlying promises that libraries—especially the big ones that Jeremy references, like React and Bootstrap—make to developers.

So again, it’s browser incompatibilities that made libraries attractive.

Jim Nielsen responds with the same message in his post Trusting Browsers:

We distrust the browser because we’ve been trained to. Years of fighting browser deficiencies where libraries filled the gaps. Browser enemy; library friend.

For example: jQuery did wonders to normalize working across browsers. Write code once, run it in any browser — confidently.

Three for three. My question has been answered: people gravitated towards libraries because browsers had inconsistent implementations.

I’m deliberately using the past tense there. I think Jim is onto something when he says that we’ve been trained not to trust browsers to have parity when it comes to supporting standards. But that has changed.

Charles again:

This approach isn’t a sustainable practice, and I’m trying to do as little of it as I can. Jeremy is right to be suspicious of third-party code. Cross-browser compatibility has gotten a lot better, and campaigns like Interop 2022 are doing a lot to reduce the burden. It’s getting better, but the exasperated I-just-want-it-to-work mindset is tough to uninstall.

I agree. Inertia is a powerful force. No matter how good cross-browser compatibility gets, it’s going to take a long time for developers to shed their suspicion.

Jim is glass-half-full kind of guy:

I’m optimistic that trust in browser-native features and APIs is being restored.

He also points to a very sensible mindset when it comes to third-party libraries and frameworks:

In this sense, third-party code and abstractions can be wonderful polyfills for the web platform. The idea being that the default posture should be: leverage as much of the web platform as possible, then where there are gaps to creating great user experiences, fill them in with exploratory library or framework features (features which, conceivably, could one day become native in browsers).

Yes! A kind of progressive enhancement approach to using third-party code makes a lot of sense. I’ve always maintained that you should treat libraries and frameworks like cattle, not pets. Don’t get too attached. If the library is solving a genuine need, it will be replaced by stable web standards in browsers (again, see jQuery).

I think that third-party libraries and frameworks work best as polyfills. But the whole point of polyfills is that you only use them when the browsers don’t supply features natively (and you also go back and remove the polyfill later when browsers do support the feature). But that’s not how people are using libraries and frameworks today. Developers are reaching for them by default instead of treating them as a last resort.

I like Jim’s proposed design princple:

Where available, default to browser-native features over third party code, abstractions, or idioms.

(P.S. It’s kind of lovely to see this kind of thoughtful blog-to-blog conversation happening. Right at a time when Twitter is about to go down the tubes, this is a demonstration of an actual public square with more nuanced discussion. Make your own website and join the conversation!)

Have you published a response to this? :

Responses

Matthias Ott

“Right at a time when Twitter is about to go down the tubes, this [blog-to-blog conversation] is a demonstration of an actual public square with more nuanced discussion. Make your own website and join the conversation!” —@adactio 👏 adactio.com/journal/19029

Maciej J

“but jQuery is also the canonical example of a library we no longer” Don’t we really? Let’s just take AJAX. I mean you could use Fetch, but IE is still around. Also $.post() is simpler then Fetch. And other AJAX libraries better integrate with other libs like Vue, React, Angular.

# Posted by Maciej J on Wednesday, May 4th, 2022 at 3:16pm

Maciej J

Also note that some people still use XP. Yes. Not a typo unfortunately😉. So that is Firefox 52 at best or Chrome 49. Lots of features might be missing even if not using IE…

# Posted by Maciej J on Wednesday, May 4th, 2022 at 3:31pm

3 Likes

# Liked by Marty McGuire on Thursday, April 28th, 2022 at 12:22pm

# Liked by Egor Kloos on Wednesday, May 4th, 2022 at 4:43pm

# Liked by Adam Argyle on Wednesday, May 4th, 2022 at 4:43pm

Previously on this day

2 years ago I wrote Modified machete

The viewing order for a Star Wars movie marathon

7 years ago I wrote 100 words 037

Day thirty seven.

12 years ago I wrote June

There is nothing in this world more bitter than Spring.

13 years ago I wrote The Death and Life of Geocities

Geocities is no longer here for you to use.

14 years ago I wrote Loosely joined

What to do with those small pieces.

17 years ago I wrote Possible Amazon redesign in the pipeline

It looks like I’ve been chosen as a guinea pig for a design that Amazon is considering. Changes like these are usually served up on a small subset of Amazon’s servers. It’s then delivered to a correspondingly small subset of visitors.

17 years ago I wrote Introducing Adactio Elsewhere

I mentioned a little while back that there seems to be more and more bits of me scattered around the internet. My photos are on Flickr, my wishlist is on Amazon, my links are on Del.icio.us and my events are on Upcoming.

20 years ago I wrote NRA Takes Credit for Bush's Win

This report on the NRA’s 131st annual meeting sounds like something from The Onion.