Skip to content

Conversation

@kidonng
Copy link
Member

@kidonng kidonng commented Jul 26, 2021

@kidonng kidonng changed the title Prevent linkify-codefrom running multiple times Prevent linkify-code from running multiple times Jul 27, 2021
@kidonng
Copy link
Member Author

kidonng commented Jul 27, 2021

Explaining the selector changes:

  • .comment-body is dropped because all code inside should also be included in .blob-wrapper

    The .d-block part is from a previous fix but we don't need it anymore

  • .blob-expanded is dropped because it is covered by .blob-wrapper tr

  • We are now using more specific selectors to select tr (.js-blob-wrapper tr and .blob-wrapper tr), because code blocks inside comments are also inside file blocks, but linkifiedURLClass will prevent the linkifying from running twice.

  • We still need the :not(.inline-comments) part for .js-blob-wrapper tr because code blocks inside .inline-comments is already handled by .blob-wrapper tr.

@fregante
Copy link
Member

fregante commented Jul 27, 2021

Thanks! Could you add a few comments explaining where each selector runs, like

// isSingleFile, isPRFiles review suggestion, etc

@fregante fregante added the bug label Jul 27, 2021
@kidonng
Copy link
Member Author

kidonng commented Jul 27, 2021

I don't think it make much sense to list every page there so keep in mind that .js-blob-wrapper is for file blocks, .blob-wrapper for anything else and that's it.

@fregante fregante merged commit 4a60549 into refined-github:main Jul 28, 2021
@fregante
Copy link
Member

Thanks!

image

@kidonng kidonng deleted the linkify-code branch August 2, 2021 18:47
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.

linkify-code runs multiple times on the same URL

2 participants