Subject: Re: bug#77299: eww-auto-rename-buffer 'title interaction with eww-readable-urls

From: Keith Amidon <[email-masked]>
Date: Thu, 12 Jun 2025 05:38:51 -0700

On 6/11/25 15:17, Jim Porter wrote:
> I think we could change how we return the readable form of the 
> document. Currently, it returns the DOM node of the section we want to 
> render, but we could instead return a new document with the <title> 
> node plus the DOM node we want to render (ditto for <link> nodes, 
> since we use those for things like 'eww-next-url').
>
> Since scoring the readability of the document requires iterating over 
> every DOM node, we could just collect the extra nodes we care about 
> (like <title>) while iterating. Then it'll be easy to include those 
> nodes in the readable form.
>
> Doing it this way should have the benefit that we don't start network 
> requests for images that won't be shown in the readable form of the page.

I had originally thought of trying to do it more-or-less likes this but 
it seemed like it would be a quite large change to code I wasn't that 
familiar with so I went with something more contained to get things 
working. It might take me a while, but I can give this approach a second 
more sustained try and see how it looks. The points about image loading 
and <link> elements are good ones. Solving those within the existing 
approach where we save even more information from the original 
"non-readable" rending of the page and possibly conditionally modify the 
renderer to avoid loading images if we're just going to switch to the 
"readable" rending automatically makes a somewhat messy situation even 
messier.