From fff4de5fa41ab51d3adada076716e6b87a002f01 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Thu, 5 Sep 2013 18:37:44 +0200 Subject: [PATCH] Take
s into account when walking down the nodes. --- src/Linkification/Linkify.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index 85617b39d..91247de5a 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -45,7 +45,11 @@ Linkify = node: -> return if @isClone or !links = @info.comment.match Linkify.catchAll - walker = d.createTreeWalker @nodes.comment, 4 + walker = d.createTreeWalker @nodes.comment, 1 | 4, acceptNode: (node) -> + return if node.nodeName in ['#text', 'BR'] + 1 # NodeFilter.FILTER_ACCEPT + else + 3 # NodeFilter.FILTER_SKIP range = d.createRange() for link in links boundaries = Linkify.find link, walker @@ -66,6 +70,8 @@ Linkify = # Walk through the nodes until we find the entire link. text = '' while node = walker.nextNode() + if node.nodeName is 'BR' + return Linkify.find link, walker text += node.data break if text.indexOf(link) > -1 return unless node