GNU bug report logs - #30546
27.0.50; shr: span tag with href attribute

Previous Next

Package: emacs;

Reported by: Katsumi Yamaoka <yamaoka <at> jpl.org>

Date: Tue, 20 Feb 2018 09:54:02 UTC

Severity: minor

Tags: patch

Found in version 27.0.50

Done: Katsumi Yamaoka <yamaoka <at> jpl.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30546 in the body.
You can then email your comments to 30546 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#30546; Package emacs. (Tue, 20 Feb 2018 09:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Katsumi Yamaoka <yamaoka <at> jpl.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 20 Feb 2018 09:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: bug-gnu-emacs <at> gnu.org
Cc: jidanni <at> jidanni.org
Subject: 27.0.50; shr: span tag with href attribute
Date: Tue, 20 Feb 2018 18:52:37 +0900
[Message part 1 (text/plain, inline)]
Hi,

Though it is not necessarily a bug[1], Firefox renders this as
a link but shr doesn't:

<span href="https://www.example.com" style="font-size:...">Foo</span>

Jidanni wrote me that some html mails he receives contain such
forms, and I tried making shr support it as the patch attached
below.  I'm not quite sure whether it causes a trouble but I'm
going to try it for some time.

Thanks.

[1] <https://stackoverflow.com/questions/46889226/is-a-span-tag-with-a-href-attribute-considered-valid>

[Message part 2 (text/x-patch, inline)]
--- shr.el~	2018-01-15 21:54:49.635451500 +0000
+++ shr.el	2018-02-20 09:47:39.198990800 +0000
@@ -1751,3 +1751,5 @@
 (defun shr-tag-span (dom)
-  (shr-generic dom))
+  (if (dom-attr dom 'href)
+      (shr-tag-a (cons 'a (cdr dom)))
+    (shr-generic dom)))
 

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30546; Package emacs. (Tue, 20 Feb 2018 11:12:02 GMT) Full text and rfc822 format available.

Message #8 received at 30546 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: 30546 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#30546: 27.0.50; shr: span tag with href attribute
Date: Tue, 20 Feb 2018 12:10:52 +0100
Katsumi Yamaoka <yamaoka <at> jpl.org> writes:

> Though it is not necessarily a bug[1], Firefox renders this as
> a link but shr doesn't:
>
> <span href="https://www.example.com" style="font-size:...">Foo</span>
>
> Jidanni wrote me that some html mails he receives contain such
> forms, and I tried making shr support it as the patch attached
> below.  I'm not quite sure whether it causes a trouble but I'm
> going to try it for some time.

That sounds kinda weird.  :-)  And I'm not able to reproduce the
behaviour in Firefox.

My crystal ball says that the page jidanni is looking at has some
Javascript that transforms the spans into links.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30546; Package emacs. (Tue, 20 Feb 2018 22:54:01 GMT) Full text and rfc822 format available.

Message #11 received at 30546 <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 30546 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#30546: 27.0.50; shr: span tag with href attribute
Date: Wed, 21 Feb 2018 07:53:41 +0900
On Tue, 20 Feb 2018 12:10:52 +0100, Lars Ingebrigtsen wrote:
> That sounds kinda weird.  :-)  And I'm not able to reproduce the
> behaviour in Firefox.

Could you try an example html mail?  I will send it to you
personally hereafter.  By sending it to Firefox using the `K H'
command, Firefox shows two likns that shr doesn't render.

> My crystal ball says that the page jidanni is looking at has some
> Javascript that transforms the spans into links.

I don't see `javascript' in the article that `K t RET' shows. :-)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30546; Package emacs. (Wed, 21 Feb 2018 08:57:02 GMT) Full text and rfc822 format available.

Message #14 received at 30546 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: 30546 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#30546: 27.0.50; shr: span tag with href attribute
Date: Wed, 21 Feb 2018 09:56:16 +0100
Katsumi Yamaoka <yamaoka <at> jpl.org> writes:

> Could you try an example html mail?  I will send it to you
> personally hereafter.  By sending it to Firefox using the `K H'
> command, Firefox shows two likns that shr doesn't render.

The email in question had the structure

<a href=...><table>...<span href=...></a>

So Firefox treats the entire table as a link.  The span href seems to be
ignored.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30546; Package emacs. (Wed, 21 Feb 2018 09:03:02 GMT) Full text and rfc822 format available.

Message #17 received at 30546 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: 30546 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#30546: 27.0.50; shr: span tag with href attribute
Date: Wed, 21 Feb 2018 10:02:23 +0100
And the reason that shr doesn't show that tablish link is that libxml
interprets this (invalid?) HTML:

	<a href="https://band.us/band/67135487/post/2088" target="_blank" style="display:block;text-decoration: none;color:#222">
												<table width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed">
													<tr>

Like this:

              (a ((href . "https://band.us/band/67135487/post/2088")
                  (target . "_blank")
                  (style . "display:block;text-decoration: none;color:#222")))
              (table ()
               (tr nil

That is, an empty <a> and then a <table>.

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





Reply sent to Katsumi Yamaoka <yamaoka <at> jpl.org>:
You have taken responsibility. (Wed, 21 Feb 2018 09:22:02 GMT) Full text and rfc822 format available.

Notification sent to Katsumi Yamaoka <yamaoka <at> jpl.org>:
bug acknowledged by developer. (Wed, 21 Feb 2018 09:22:02 GMT) Full text and rfc822 format available.

Message #22 received at 30546-done <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 30546-done <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#30546: 27.0.50; shr: span tag with href attribute
Date: Wed, 21 Feb 2018 18:21:06 +0900
On Wed, 21 Feb 2018 09:56:16 +0100, Lars Ingebrigtsen wrote:
> The email in question had the structure

> <a href=...><table>...<span href=...></a>

> So Firefox treats the entire table as a link.  The span href seems to be
> ignored.

I realized that the url values of <a href=...> and <span href=...>
are the same.  I tried changing the value of <span href=...> and
verified Firefox doesn't use it as a separate link.  Thank you for
investigating it.  I'm closing this bug.

Regards,




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30546; Package emacs. (Wed, 21 Feb 2018 09:25:01 GMT) Full text and rfc822 format available.

Message #25 received at 30546 <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 30546 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#30546: 27.0.50; shr: span tag with href attribute
Date: Wed, 21 Feb 2018 18:24:44 +0900
On Wed, 21 Feb 2018 10:02:23 +0100, Lars Ingebrigtsen wrote:
> And the reason that shr doesn't show that tablish link is that libxml
> interprets this (invalid?) HTML:

> 	<a href="https://band.us/band/67135487/post/2088" target="_blank" style="display:block;text-decoration: none;color:#222">
> 												<table width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed">
> 													<tr>

> Like this:

>               (a ((href . "https://band.us/band/67135487/post/2088")
>                   (target . "_blank")
>                   (style . "display:block;text-decoration: none;color:#222")))
>               (table ()
>                (tr nil

> That is, an empty <a> and then a <table>.

Oh, the email in question is simply broken.  Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#30546; Package emacs. (Thu, 22 Feb 2018 00:33:01 GMT) Full text and rfc822 format available.

Message #28 received at 30546 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 30546 <at> debbugs.gnu.org
Subject: Re: bug#30546: 27.0.50; shr: span tag with href attribute
Date: Thu, 22 Feb 2018 08:32:06 +0800
>>>>> "KY" == Katsumi Yamaoka <yamaoka <at> jpl.org> writes:
KY> Oh, the email in question is simply broken.  Thanks.

OK I told https://band.us/cs/help . 




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 22 Mar 2018 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 89 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.