Web Tools #491 - el.before()/after(), JS Utils, Testing, React Native

Web Tools Weekly
WEB VERSION
Tools for Web Developers

Issue #491 • December 15, 2022

Advertisement
What’s the Biggest Development Trend for 2023
Did you know that web developers are gradually settling for a smaller number of frameworks as they stop experimenting with a wide range of tools? Take part in the most complete survey Developer Nation has ever created, share your thoughts and win amazing prizes!

Start Here
Developer Nation Survey

There are lots of different ways to inject content into the DOM with JavaScript. Some of such methods have been around what feels like forever – since the days of IE5. Over the years though, the DOM spec has added other more practical methods that are designed for specific use cases. Or in some instances, methods have been added for simplicity.

Take for example the Element.before() and Element.after() methods. These two methods have been supported in all modern browsers for some time now but aren't exactly 'legacy' methods like some of the others we use to inject content.

Each of these methods allows you add a comma-separated set of nodes or string objects at the desired location. If you're using Element.before(), then the content will be inserted before the specified element (that is inside its parent, as an immediate sibling). If you're using Element.after(), the content will be added after the element.

Here's some code to demonstrate:

let par = document.createElement('p'),
    span = document.createElement('span');

parent.lastElementChild.after(par, 'example', span);

The above assumes a parent element and is purely to demonstrate. This wouldn't be a very practical example. As you can see, I'm able to pass in multiple parameters and they can either be element references or strings of text. The above code, however, would produce a strange and likely broken HTML experience.

For a more practical example, try out this CodePen demo. You can use the buttons on the page to inject the content at the specified locations defined in the JavaScript.

Some things to note about these two methods:

  • The number of comma-separated elements and/or strings you can pass in as arguments is unlimited
  • If you insert strings, each one you insert is included as a separate text node, even if they're adjacent
  • The methods don't return any data or objects
  • If in some rare case the node cannot be inserted, you'll get something called a HierarchyRequestError (i.e. a type of DOMException)
Although these two methods seem to be lesser-known, they are probably more useful than some other more obscure methods available for DOM manipulation. 

Now on to this week's tools!

 

JavaScript Utilities

What’s the Biggest Development Trend for 2023?
Did you know that web developers are gradually settling for a smaller number of frameworks as they stop experimenting with a wide range of tools? Take part in the most complete survey Developer Nation has ever created, share your thoughts and win amazing prizes!     SPONSORED  

idle-task
A wrapper around requestIdleCallback() to improve your website performance by executing JavaScript during a browser's idle periods.

Maska
An input mask for form inputs, to force an input format depending on the type of field, for vanilla JavaScript and Vue.

undefined
A Node.js utility to convert a file of JSON responses into TypeScript types.

watching-you
A JavaScript library for building animations that watch anything in the DOM. The demo example is a pair of eyes following the mouse around the page.

BlockNote
A Notion-style block-based extensible text editor built on top of ProseMirror and Tiptap.

Snow.js
Add a script to any web page to add an animated snow effect to the page's background.

Snow.js

CSV To Markdown Table
An older project that's a simple JavaScript-based CSV to Markdown table converter.

Legend-State
A super-fast and powerful state manager for JavaScript apps that's easy to use. It works as a vanilla JavaScript tool but it's built for React apps as well.

BookmarkFS
A 'dumb' project that exploits what seems to be a flaw in Chrome's bookmark sync service that allows you to store files for free.

Blocky Editor
A block-based editor that's small and fast enough to be embedded in Notion-like apps, doesn't depend on any heavy editor framework, and handles complex text-editing details for you.

📢 On the Release Radar:

Testing and Debugging Tools

Powerful Video Editor SDK for Web
With client-side processing, full customization and powerful editing tools Video Editor SDK lets you effortlessly add video editing to your web app. All with just a few lines of code.   SPONSORED  

Free Website Speed Test
From DebugBear, includes higher-quality data than PageSpeed Insights and a detailed request waterfall for debugging.

MLab Speed Test
A library to test your download and upload speed using Measurement Lab's speed test tool.

xv
A fast zero-config test runner that's simple, works with TypeScript, and only exports test functions without hiding console.logs, raw errors, etc.

LocatorJS
A Chrome extension that lets you click on any component in the browser to open its code in your IDE. Also available as a library for React, Vue, Svelte, Preact, and Solid.

Jam
Chrome extension for bug reports that lets you capture your screen plus developer logs in one click. Has a decent free plan for solo developers.

Stroo
An open-source web app to publish and share software structures, as a helpful visual addition to documentation.

Stroo

hypertest
A Go-based test runner for the command line that lets you run tests in the background while coding, and get immediate live feedback.

WorkerBox
A secure sandbox to execute untrusted user JavaScript in a web browser without any risk to your own domain/site/page.

Eleven
A CLI to create code sandboxes with automatic HTTPS and long running processes in your cloud provider account.

SadServers
A SaaS where users can test their Linux troubleshooting skills on real Linux servers in a "Capture the Flag" fashion.

📢 On the Release Radar:

React Native and Mobile Tools

Powerful Video Editor SDK for Web
With client-side processing, full customization and powerful editing tools Video Editor SDK lets you effortlessly add video editing to your web app. All with just a few lines of code.   SPONSORED  

STF
A web application for debugging smartphones, smartwatches, and other gadgets remotely from the comfort of your browser.

react-native-share
A simple React Native library that adds the ability to share files and messages with other apps.

react-native-context-menu-view
Use native context menu functionality from React Native, for iOS 13 and above and Android.

React Native Elements
A React Native UI toolkit with customizable components for building cross-platform applications.

Quick SQLite
Fast SQLite for React Native that embeds the latest version of SQLite and provides a low-level JSI-backed API to execute SQL queries.

OsmiCSX
A utility framework for React Native for rapidly building custom user interfaces, similar to Tailwind CSS.

OsmiCSX

React Native Drag Text Editor
A 60FPS dynamic text editor powered with Reanimated for no-code, photo editor cases.

Expo Router Preview
A preview of the new router for React Native apps, currently in beta and not recommended for production use, but the repo can be used for early bugs and feedback.

redash
A toolkit for implementing React Native Reanimated and GestureHandler.

pixels-catcher
A JavaScript/TypeScript library for testing React Native UI components and screens.

Interactable
An old project looking for maintainers that's an experimental implementation of a declarative API for handling fluid user interactions with views at 60 FPS in React Native (e.g. swipeable cards, drawers, etc).
 

Commercial Apps and Classifieds

These are commercial apps, affiliate links, PPC ads, and paid classifieds. Submit yours!
VRTs – A WordPress Plugin to test for visual changes and notifies you upon alerts automatically.
TinyUX – Android app to quickly create low-fi wireframes from anywhere at anytime.
Noom – A science-based approach to weight loss, used successfully by millions.    AD
The Juice – Career-enhancing resources from top brands and thought leaders in one place.  AD
Visualping – Service to monitor websites changes and get automated alerts.
Coherence – A dev platform that integrates development, testing, and production in one dashboard.
Interval – A code-first platform to build internal tools, prototypes, and more.

A Tweet for Thought

Jack Forge explains why all tech workers need all three operating systems.
 
A Tweet for Thought
 

Send Me Your Tools!

Made something? Send links via Direct Message on Twitter @WebToolsWeekly (details here). No tutorials or articles, please. If you have any suggestions for improvement or corrections, feel free to reply to this email.
 

Before I Go...

This is pretty amazing: Harvard CS50 – Full Computer Science University Course is a 25-hour YouTube video that offers "an introduction to the intellectual enterprises of computer science and the art of programming", from Harvard University.

Thanks to everyone for subscribing and reading!

Keep tooling,
Louis
@WebToolsWeekly
PayPal.me/WebToolsWeekly

Key phrases

Older messages

Web Tools #490 - Math.random(), CSS Tools, Git/CLI, Uncats

Thursday, December 8, 2022

Web Tools Weekly WEB VERSION Issue #490 • December 8, 2022 Advertisement Use Full Power of MySQL with All-in-one IDE dbForge Studio for MySQL is a full-fledged IDE for database development, management

Web Tools #489 - Array.values(), Media Tools, React, Git/CLI

Thursday, December 1, 2022

Web Tools Weekly WEB VERSION Issue #489 • December 1, 2022 Advertisement The Future Of Tech, Delivered Today. Join over 450K people by reading Emerging Tech Brew, the 3-times-a-week email delivering

Web Tools #488 - copyWithin(), JS Utilities, Databases, Uncats

Thursday, November 24, 2022

Web Tools Weekly WEB VERSION Issue #488 • November 24, 2022 Advertisement Hey Devs, Meet TelemetryHub! TelemetryHub is an observability tool that collects all your complex telemetry data into a single

Web Tools #487 - Autocomplete, CSS Tools, Build Tools, Uncats

Thursday, November 17, 2022

Web Tools Weekly WEB VERSION Issue #487 • November 17, 2022 Advertisement Turn Heads on Video with mmhmm Put yourself on screen with your slides. Move around for emphasis. Works with Zoom, Meet, and

Web Tools #486 - Future CSS, Frameworks, Media, React

Thursday, November 10, 2022

Web Tools Weekly WEB VERSION Issue #486 • November 10, 2022 Advertisement Get Early Access to TelemetryHub! TelemetryHub is an observability tool that collects all your complex telemetry data into a

You Might Also Like

Software Testing Weekly - Issue 218

Friday, May 3, 2024

Unit, Integration and End-to-End Tests 🔧 View on the Web Archives ISSUE 218 May 4th 2024 COMMENT Welcome to the 218th issue! I loved going through this discussion among software engineers: What is your

gpt2-chatbot and OpenAI search engine - Weekly News Roundup - Issue #465

Friday, May 3, 2024

Plus: Med-Gemini; Vidu - Chinese answer to OpenAI's Sora; the first race of Abu Dhabi Autonomous Racing League; deepfaking celebrities to teach math and physics; and more! ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

NASA comes to the rescue of crowded rocket launch sites

Friday, May 3, 2024

Plus: Fisker's legal woes and Sprinklr lays off 100 View this email online in your browser By Christine Hall Friday, May 3, 2024 Good afternoon, and welcome to TechCrunch PM. We made it to Friday,

🎮 Forget the PS5 Pro, I Still Love My PS4 — The Best Lock Screen Widgets for iPhone

Friday, May 3, 2024

Also: Smart Home Mistakes to Avoid, and More! How-To Geek Logo May 3, 2024 Did You Know Half of the world's geysers are located in Yellowstone National Park. 🔑 More Passkeys Happy Friday! You can

JSK Daily for May 3, 2024

Friday, May 3, 2024

JSK Daily for May 3, 2024 View this email in your browser A community curated daily e-mail of JavaScript news The Power of React's Virtual DOM: A Comprehensive Explanation Modern JavaScript

Musk raises $6B for AI startup

Friday, May 3, 2024

Also, is TikTok dodging Apple's commissions? View this email online in your browser By Haje Jan Kamps Friday, May 3, 2024 Welcome to Startups Weekly — Haje's weekly recap of everything you can

SWLW #597: Seek first to understand, The "Iterative Adjacent Possible", and more.

Friday, May 3, 2024

Weekly articles & videos about people, culture and leadership: everything you need to design the org that makes the product. A weekly newsletter by Oren Ellenbogen with the best content I found

iOS Dev Weekly - Issue 659

Friday, May 3, 2024

Is Swift 6 hitting one of the REAL hard problems? Not generics, not data race safety, but naming things! 😬 View on the Web Archives ISSUE 659 May 3rd 2024 Comment Naming things is one of the two hard

Daily Coding Problem: Problem #1430 [Easy]

Friday, May 3, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Facebook. You have a large array with most of the elements as zero. Use a more space-

Making sense of product management

Friday, May 3, 2024

​ Getting a sense of product sense Whenever I hear the term product sense, I think back to a Seinfeld episode about write-offs (with a little artistic license). Jerry: “You don't even know what