gregjacobs / Autolinker.js

Utility to Automatically Link URLs, Email Addresses, Phone Numbers, Twitter handles, and Hashtags in a given block of text/HTML
MIT License
1.48k stars 238 forks source link

Autolinker fails to recognize html tags without space-separated attributes #146

Closed bengotow closed 8 years ago

bengotow commented 8 years ago

Autolinker incorrectly tried to "linkify" the URL found in the following block of HTML:

<img src="https://ssl.gstatic.com/mail/welcome/localized/en/welcome_calendar.png" alt="Calendar" style="display:block;"width="129"height="129"/>

After:

<img src="<a href="https://ssl.gstatic.com/mail/welcome/localized/en/welcome_calendar.png">https://ssl.gstatic.com/mail/welcome/localized/en/welcome_calendar.png</a>" alt="Calendar" style="display:block;"width="129"height="129"/>

If you put spaces between the width, height and style tags, it parses it properly and does not autolink:

<img src="https://ssl.gstatic.com/mail/welcome/localized/en/welcome_calendar.png" alt="Calendar" style="display:block;"width="129"height="129"/>
bengotow commented 8 years ago

(I will submit a PR for this!)