TIL there are nullish coalescing operator (??
) and assignment (??=
) in many programming languages, including JavaScript.
Never used them, always either using ||
or initialising variables with undefined
.
Should I refactor? 🤔
There are 49 contents with this tag:
TIL there are nullish coalescing operator (??
) and assignment (??=
) in many programming languages, including JavaScript.
Never used them, always either using ||
or initialising variables with undefined
.
Should I refactor? 🤔
TIL IntersectionObserver
's rootMargin
only works if the observer is in the same origin, because of privacy concerns:
There is a risk that the API may be used to probe for information about the geometry of the global viewport itself, which may be used to deduce the user’s hardware configuration.
That's why this demo of a sticky navigation doesn't work in CodePen's default view… 😞
I want to be a web developer, not a JavaScript developer.
Which (stable, lightweight, maintained, etc.) npm package would you recommend to transform any RSS or Atom feeds to a standard JSON Feed format?
While we wait for browsers to implement the text-wrap: balance;
#CSS property and value for text (pleeeeeease! 🙏), I may have created a silly — and probably sub-optimal — function to do it with HTML block elements:
https://codepen.io/nhoizey/pen/mdjbrVx
Tell me what you think!
But why? Just because a colleague needed it, we could not find a solution in pure CSS, and I like challenges… 😅
I needed a JavaScript way to verify if two arrays contain the same (all different) values.
I then found a better solution for my use case, but it might be useful later, so here it is:
const sameValues = (array1, array2) =>
array1.length === array2.length &&
array1.every((element) => array2.includes(element));
Many of the latest additions to HTML, CSS, and JavaScript first existed as JavaScript libraries or frameworks or pre-processors or polyfills and then found their way into the standards process, back into the layers of web technology that move slower and are more resilient.
Google Needs 9× More Time To Crawl JS Than HTML
It took Google 313 hours to get to the final, seventh page of the JavaScript folder.
Sam Magura
Why We're Breaking Up with CSS-in-JS
Thanks for reading this deep dive into runtime CSS-in-JS. Like any technology, it has its pros and cons. Ultimately, it's up to you as a developer to evaluate these pros and cons and then make an informed decision about whether the technology is right for your use case. For us at Spot, the runtime performance cost of Emotion far outweighed the DX benefits, especially when you consider that the alternative of Sass Modules + utility classes still has a good DX while providing vastly superior performance.
Google doesn't see content behind Load More buttons or Infinite Scroll
Google’s John Mueller has confirmed in a Webmaster Hangout that they no longer crawl content behind JavaScript “load more” buttons. Also, Mueller confirmed that they might not crawl all content loaded via the infinite scroll technique either.
Async Alpine — Asynchronous Alpine component loading
Async Alpine is a wrapper for the fantastic Alpine.js JavaScript library, giving you greater control of component loading and adding asynchronous/lazy loading to Alpine. This makes loading components when visible, for certain screen widths, on events and more, super simple!
For all the resulting script is asynchronous, the <script> block that creates it is fully synchronous, which means that the discovery of the script is governed by any and all synchronous work that happens before it, whether that’s other synchronous JS, HTML, or even CSS. Effectively, we’ve hidden the file from the browser until the very last moment, which means we’re completely failing to take advantage of one of the browser’s most elegant internals… the Preload Scanner.
Joe Liccini
Why Your Cached JavaScript Is Still Slow and Incurs Performance Overhead
Caching assets is a fantastic way to optimize the network overhead of your web application, there is still plenty of computational overhead associated with cached JavaScript.
The re-execution of code on the client that the server already executed as part of SSR/SSG is what makes hydration pure overhead: that is, a duplication of work by the client that the server already did. The framework could have avoided the cost by transferring information from the server to the client, but instead, it threw the information away.
Joe Liccini
Why Your Cached JavaScript Is Still Slow and Incurs Performance Overhead
Most developers still don't understand that large JavaScript code is really hurting performance, let's hope this great explanation by Joe, that this is really not just about network, will help:
With JavaScript, how would you compute all sorted permutations of 1 to n elements from a given array?
For example, with this source [1, 2, 3]
and n=2
How would you get this?
[[1], [2], [3], [1, 2], [1, 3], [2, 3]];
Routing: I’m not smart enough for a SPA
Here comes Taylor's 4th article in his great "Streets" series about web performance and front end architectures.
Thoughtworks Technology Radar Volume 26
In [the Techniques section], there's a "SPA by default" blip set to "Hold":
Me: I would use a link with an image:
<a href="link/to/profile"><img src="picture.jpg" alt="Nicolas Hoizey" /></a>
Twitter:
🤷♂️
This migration from basicHTML to LinkeDOM in images-responsiver looks good! 😍
I have yet to find if this behavior with HTML entities is an issue.
I'm often ashamed to have to ask for help with JavaScript code, feeling like I'm not up to the task, like I'm an imposter with my few open source projects.
https://github.com/WebReflection/linkedom/issues/69#issuecomment-866797308
I shouldn't be.
But that's the way it is… 🤷♂️
JavaScript performance beyond bundle size
There’s a huge focus recently on JavaScript bundle size: how big are your dependencies? Could you use a smaller one? Could you lazy-load it? But I believe we focus on bundle size first and foremost because it’s easy to measure.
The juxtaposition of The HTTP Archive’s analysis and The State of JS 2020 Survey results suggest that a disproportionately small—yet exceedingly vocal minority—of white male developers advocate strongly for React, and by extension, a development experience that favors thick client/thin server architectures which are given to poor performance in adverse conditions. Such conditions are less likely to be experienced by white male developers themselves, therefore reaffirming and reflecting their own biases in their work.
Loading and replacing HTML parts with HTML
I really would like HTML to be more powerful, and I think showing other content without a full page reload is something people wanted for decades and will probably also want in the future, so it may be worth to see if we can do this in HTML.
HTML and CSS techniques to reduce your JavaScript
relying on solutions provided natively by browsers enables you to benefit at low cost from the expertise of the community creating web standards. These solutions generally have the advantage of using less code, thus reducing maintenance efforts for a development team (for example, no need to update the libraries used).
I wish I could offer this great UX for less than 537 KB of #Algolia JavaScript libraries… 😥
Please disable JavaScript to view this site
Most of the web sites I visit on an average day require JavaScript to allow me to navigate the site fully. At least once a week there will be a web site that fails to fully load JavaScript for me and I'll (rage) quit the site and usually committing it to a bank of "web sites I can't be arsed to ever visit again because they messed up".
When you have a search form on every page, with #Algolia's autocomplete, what is the current best way to load the full required JavaScript only when the input gets the focus?
I didn't start using #Svelte yet, but this presentation of what will come soon really makes we want to find time to do it ASAP! 😍
Always remember that although a subset of the JavaScript community can be very loud, they represent a paltry portion of the web as a whole. This means that when they say something like “CSS sucks”—what they mean is “CSS sucks for a small subset of less than 1 percent of the web”
When @getify writes "It took my brain weeks to fully understand the implications of that juggling", I wonder if I really should try to understand… 😅
Looks fascinating anyway:
https://github.com/getify/Functional-Light-JS/blob/master/manuscript/apA.md
The Cost of Javascript Frameworks
In an ideal world, I believe a framework should go beyond developer experience value and provide concrete value for the people using our sites. Performance is just one part of that—accessibility and security both come to mind as well—but it’s an essential part.
Second-guessing the modern web
[…] there is a swath of use cases which would be hard without React and which aren’t complicated enough to push beyond React’s limits. But there are also a lot of problems for which I can’t see any concrete benefit to using React. Those are things like blogs, shopping-cart-websites, mostly-CRUD-and-forms-websites. For these things, all of the fancy optimizations are optimizations to get you closer to the performance you would’ve gotten if you just hadn’t used so much technology.
Great article where Kitty shows how React helps providing N26 clients the features they're looking for even if they unfortunately have JavaScript issues.
I remember seing a clever design years ago that had this effect on scroll, but it was just for a logo, with a single image.
The layered approach of progressive enhancement echoes the separation of concerns in the front-end stack: HTML, CSS, and JavaScript—each layer expressing more power. But while these concepts are related, they’re not interchangable. Separating out the layers of your tech stack isn’t necessarily progressive enhancement. If you have some HTML that relies on JavaScript to be useful, then there’s no benefit in separating that HTML into a separate payload. The HTML that you initially send down the wire needs to be functional (at least at a basic level) before the JavaScript arrives.
If code is explicit and testable but hard to read and follow, then we’ve lost our most important property along the way. Code is first and foremost designed to be read by humans, not computers. Turning source code into CPU instructions is the compiler’s job, not mine […]
When should you be using Web Workers?
Surma explains very well how “low-end phones will mostly likely be used by the massive number of people coming online in the next couple of years“, and why we need to take that into account when we design our frontend Web architectures.
Front-end Developer Handbook 2019
If you want to grok the great diversity of topics and technologies involved in Front-end Web development, here is probably the most comprehensive source you can find nowadays.
If you’re going to build an image loader that hides the whole page until all images are ready, you must also ask yourself what if the images don’t arrive?
What catches my eye are the gaps between TTFB and the paint metrics, and between the paint metrics and First CPU Idle. These gaps are caused by JavaScript dominating the browser main thread. This happens after TTFB when all the blocking scripts are executed – these have to finish before any rendering can happen.
JavaScript universel et architecture isomorphe
On parle depuis quelque temps de « JavaScript isomorphe » pour décrire des architectures Web dans lesquelles on abandonne les principes historiques des Single Page Applications composées de coquilles HTML vides et moult JavaScript pour les remplir. Le JavaScript isomorphe a plutôt comme principe de produire des pages HTML pleinement fonctionnelles dès la sortie du serveur, mais chargeant elles aussi moult JavaScript pour prendre le relai —si possible— afin d'améliorer l'expérience utilisateur. Je propose que l'on parle d'« architecture isomorphe », une implémentation possible étant en « JavaScript universel ».
La navigation ne se fige plus en haut de l'écran lors du scroll
Vous l'avez peut-être constaté par vous-même, le menu de navigation de ce site[1] ne se fige plus en haut de l'écran quand vous descendez dans la page. Ce fonctionnement que j'avais trouvé très sexy s'avère poser plusieurs problèmes, donc j'ai préféré le supprimer.
Oncle Tom m'a envoyé en douce il y a quelques jours une patate chaude en m'invitant à vous parler de mes conventions de codage. Vaste sujet, et surtout très vite trollesque, de quoi se régaler.
Les carrousels en 3D sont à la mode
J'ai vu apparaître ces derniers jours des carrousels en 3D sur les pages des sites de vente en ligne Amazon et Alapage, drôle de coïncidence !
Certain(e)s d'entre vous préfèrent lire les commentaires sur les articles par ordre chronologique, comme c'est obligatoirement le cas avec certains outils de gestion de contenus Web, et d'autres, habitués aux forums, préfèrent suivre les enchainements de discussions[1].
Comment définir dans jQuery ses propres filtres de sélection
Article initialement publié dans le weblog de Clever Age.
Grâce à Google Groups, sorti récemment en version beta[1], j'ai retrouvé la trace de mes premiers pas sur les newsgroups, le 12 décembre 1996 !
See all tags.