Archive for November 6, 2023

Monday, November 6, 2023

Mastering DOM Manipulation With Vanilla JavaScript

Phuoc Nguyen (via Hacker News):

Web development moves at lightning speed. I still remember when I first started using libraries like jQuery, Prototype, script.aculo.us, Zepto, and many more. Even with modern tools like Angular, VueJS, React, Solid and Svelte, we still have to deal with the Document Object Model (DOM). While these frameworks encapsulate and hide direct DOM management, they still give us access to work with the DOM via refs and event handlers.

Whether you’re developing or using a web component in any framework, you need to work with the DOM at a certain level. […]

That’s why I’ve put together this collection of resources:

  • No external libraries, just native browser APIs
  • Small, easy-to-understand examples
  • Live demos
  • Tips and best practices included
  • Real-life use cases
  • Works with modern browsers and even supports Internet Explorer

Update (2023-11-22): See also: Cheat sheet for moving from jQuery to vanilla JavaScript (via Daniel).

Google Vertex AI Search

Brett Terpstra:

So it turns out Google now offers an API (once again). It’s limited to 100 searches per day for the free version, so I don’t want to put my API key into the public distribution of SearchLink, but if you want to tap into Google’s power for your searches, you can now add your own API key to the config and get 100 searches per day for free.

This is the JSON API for the Custom Search feature that I was not a fan of. But, using the API, you can format the results however you want.

There’s also a Custom Search Site Restricted JSON API, which could be used to build a site-specific search page, but it’s being phased out.

Google:

Vertex AI Search allows you to set up and deploy a Google-grade site search engine in minutes at a competitive price.

[…]

Because we believe Vertex AI Search best serves the needs of site restricted search use cases, we are no longer receiving new customers for the Custom Search Site Restricted JSON API. This has no effect on existing customers.

Google:

With the advent of generative AI your consumers and employees expect a better search experience than keyword-based tools that only match specific terms for information and do not understand user intent, content or the context of the search. We're building Vertex AI Search based on decades of Google's investments in search technologies and integrating new generative AI features so your customers and employees can enjoy a modern, personalized search experience.

It looks like the pricing is $4 per 1,000 queries vs $5 for the old API.

Previously: