Skip to content

Preserve span tags inside links - #703

Closed
rooneyg21 wants to merge 1 commit into
refined-github:masterfrom
rooneyg21:695-bug-fix
Closed

rooneyg21 wants to merge 1 commit into
refined-github:masterfrom
rooneyg21:695-bug-fix

Conversation

@rooneyg21

Copy link
Copy Markdown
Contributor

When part of a url is changed, github adds another class to that part of the url to highlight the
change. This added extra nodes in between the url. Hence, the url is being linkified upto the change
resulting in invalid links
closes #695

@fregante fregante left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. As is, this code doesn't need jQuery; use select() and select.exists()
  2. The whole block should probably precede the getTextNodes loop because it disregards the individual textnodes
  3. The added code does not check linkified.children.length > 0 so it executes replaceWith even if it's not necessary
  4. This solution discards the diff information:

Current PR:

screen shot 2017-09-25 at 17 29 03

Should preserve span tags inside link:

screen shot 2017-09-25 at 17 28 51

@rooneyg21 rooneyg21 changed the title fix(Clickable links): Make links work when part of an url is changed fix(Clickable links): preserve span tags inside link Sep 27, 2017
@sindresorhus sindresorhus changed the title fix(Clickable links): preserve span tags inside link Preserve span tags inside links Oct 2, 2017
@fregante fregante added the bug label Oct 14, 2017
@fregante
fregante force-pushed the master branch 3 times, most recently from 82eb089 to 9bdf5cf Compare October 16, 2017 05:27
@fregante

fregante commented Nov 4, 2017

Copy link
Copy Markdown
Member

Give that the requested changes require a rewrite, do you mind sending a new PR after #796 is merged?

@fregante fregante closed this Nov 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Auto-linking is not correctly applied to links in diffs

2 participants