Subject: Re: bug#40532: 28.0.50; eww/shr: Anchor link does not work

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 19 May 2020 14:23:46 +0200

"Basil L. Contovounesios" <[email-masked]> writes:

> OTOH if the shr-target-id property is always attached to the relevant
> 'id' and (deprecated) 'name' attributes, then cached table contents will
> still be searchable.  This shouldn't be overkill in terms of performance
> because yet another text property on a subet of the DOM should be
> comparatively cheap, right?
>
> So WDYT of the following fix?  Can you think of any better solutions?

The patch is a bit hard to read, because it seems to have a lot of
unrelated changes like:

> -(require 'shr)
> -(require 'url)
> -(require 'url-queue)
> -(require 'thingatpt)
>  (require 'mm-url)
>  (require 'puny)
> -(eval-when-compile (require 'subr-x)) ;; for string-trim
> +(require 'shr)
> +(require 'text-property-search)
> +(require 'thingatpt)
> +(require 'url)
> +(require 'url-queue)
> +(eval-when-compile (require 'subr-x))

and

> -    (when (and shr-target-id
> -	       (equal (dom-attr dom 'name) shr-target-id))
> -      ;; We have a zero-length <a name="foo"> element, so just
> -      ;; insert...  something.
> +    (when-let* ((id (or (dom-attr dom 'id)
> +                        ;; Obsolete since HTML5.
> +                        (dom-attr dom 'name))))
> +      ;; We have an empty element, so just insert... something.

and

> -	    (insert "*"))
> -	  (put-text-property start (1+ start) 'shr-target-id shr-target-id))
> +            (insert ?*)
> +            (put-text-property (1- (point)) (point) 'display ""))
> +          (put-text-property start (1+ start) 'shr-target-id id))

so I can't really make out what the changes you're making in this area is...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no