unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30546: 27.0.50; shr: span tag with href attribute
@ 2018-02-20  9:52 Katsumi Yamaoka
  2018-02-20 11:10 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Katsumi Yamaoka @ 2018-02-20  9:52 UTC (permalink / raw)
  To: 30546; +Cc: jidanni

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

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>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 260 bytes --]

--- 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)))
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#30546: 27.0.50; shr: span tag with href attribute
  2018-02-20  9:52 bug#30546: 27.0.50; shr: span tag with href attribute Katsumi Yamaoka
@ 2018-02-20 11:10 ` Lars Ingebrigtsen
  2018-02-20 22:53   ` Katsumi Yamaoka
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2018-02-20 11:10 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 30546, jidanni

Katsumi Yamaoka <yamaoka@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#30546: 27.0.50; shr: span tag with href attribute
  2018-02-20 11:10 ` Lars Ingebrigtsen
@ 2018-02-20 22:53   ` Katsumi Yamaoka
  2018-02-21  8:56     ` Lars Ingebrigtsen
  2018-02-21  9:02     ` Lars Ingebrigtsen
  0 siblings, 2 replies; 8+ messages in thread
From: Katsumi Yamaoka @ 2018-02-20 22:53 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 30546, jidanni

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. :-)





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#30546: 27.0.50; shr: span tag with href attribute
  2018-02-20 22:53   ` Katsumi Yamaoka
@ 2018-02-21  8:56     ` Lars Ingebrigtsen
  2018-02-21  9:21       ` Katsumi Yamaoka
  2018-02-21  9:02     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2018-02-21  8:56 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 30546, jidanni

Katsumi Yamaoka <yamaoka@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#30546: 27.0.50; shr: span tag with href attribute
  2018-02-20 22:53   ` Katsumi Yamaoka
  2018-02-21  8:56     ` Lars Ingebrigtsen
@ 2018-02-21  9:02     ` Lars Ingebrigtsen
  2018-02-21  9:24       ` Katsumi Yamaoka
  1 sibling, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2018-02-21  9:02 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 30546, jidanni

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






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#30546: 27.0.50; shr: span tag with href attribute
  2018-02-21  8:56     ` Lars Ingebrigtsen
@ 2018-02-21  9:21       ` Katsumi Yamaoka
  0 siblings, 0 replies; 8+ messages in thread
From: Katsumi Yamaoka @ 2018-02-21  9:21 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 30546-done, jidanni

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,





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#30546: 27.0.50; shr: span tag with href attribute
  2018-02-21  9:02     ` Lars Ingebrigtsen
@ 2018-02-21  9:24       ` Katsumi Yamaoka
  2018-02-22  0:32         ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 8+ messages in thread
From: Katsumi Yamaoka @ 2018-02-21  9:24 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 30546, jidanni

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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#30546: 27.0.50; shr: span tag with href attribute
  2018-02-21  9:24       ` Katsumi Yamaoka
@ 2018-02-22  0:32         ` 積丹尼 Dan Jacobson
  0 siblings, 0 replies; 8+ messages in thread
From: 積丹尼 Dan Jacobson @ 2018-02-22  0:32 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: Lars Ingebrigtsen, 30546

>>>>> "KY" == Katsumi Yamaoka <yamaoka@jpl.org> writes:
KY> Oh, the email in question is simply broken.  Thanks.

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-02-22  0:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-20  9:52 bug#30546: 27.0.50; shr: span tag with href attribute Katsumi Yamaoka
2018-02-20 11:10 ` Lars Ingebrigtsen
2018-02-20 22:53   ` Katsumi Yamaoka
2018-02-21  8:56     ` Lars Ingebrigtsen
2018-02-21  9:21       ` Katsumi Yamaoka
2018-02-21  9:02     ` Lars Ingebrigtsen
2018-02-21  9:24       ` Katsumi Yamaoka
2018-02-22  0:32         ` 積丹尼 Dan Jacobson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).