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

New lines in anchor's style tag break Autolinker #79

Closed philfreo closed 9 years ago

philfreo commented 9 years ago

If there's a newline (\n) in the style tag then bad stuff happens:

Autolinker.link('<a href="http://close.io/" style="font-family: Helvetica,\nArial">http://close.io</a>')

Yields:

<a href="<a href="http://close.io/" target="_blank">close.io</a>" style="font-family: Helvetica,
Arial"><a href="http://close.io" target="_blank">close.io</a></a>

If you remove the \n then you simply get the expected result of:

<a href="http://close.io/" style="font-family: Helvetica, Arial">http://close.io</a>
gregjacobs commented 9 years ago

Hey, good catch, will take a look.

gregjacobs commented 9 years ago

Nice, easy fix in 9cce7f50458102d6d7bbbeca8f2d73c68d337e53/v0.15.1

philfreo commented 9 years ago

Thanks! :+1: