Take <br>s into account when walking down the nodes.
This commit is contained in:
parent
2ee7a064ca
commit
fff4de5fa4
@ -45,7 +45,11 @@ Linkify =
|
|||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
return if @isClone or !links = @info.comment.match Linkify.catchAll
|
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()
|
range = d.createRange()
|
||||||
for link in links
|
for link in links
|
||||||
boundaries = Linkify.find link, walker
|
boundaries = Linkify.find link, walker
|
||||||
@ -66,6 +70,8 @@ Linkify =
|
|||||||
# Walk through the nodes until we find the entire link.
|
# Walk through the nodes until we find the entire link.
|
||||||
text = ''
|
text = ''
|
||||||
while node = walker.nextNode()
|
while node = walker.nextNode()
|
||||||
|
if node.nodeName is 'BR'
|
||||||
|
return Linkify.find link, walker
|
||||||
text += node.data
|
text += node.data
|
||||||
break if text.indexOf(link) > -1
|
break if text.indexOf(link) > -1
|
||||||
return unless node
|
return unless node
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user