Slack uses markdown-style backtick syntax for code spans. Example:
one `code` two
This is the rendered HTML for the above:
<span class="message_body">
one
<code class="special_formatting">
<span class="copyonly">`</span>code<span class="copyonly">`</span>
</code>
two
</span>
Previously, `.textContent` was used to copy element text. Because those
backticks actually are there in the DOM, they get copied too. However,
that's unexpected because they're not visible. The `yv` command is
supposed to be equivalent to `zv<hintchars>y`, but this meant that it
wasn't.
This commit instead creates an actual selection and then invokes
Firefox's `cmd_copy` command (which is exactly what `zv` followed by `y`
does). A difference is that now you can see the created selection flash
for a split second, but I actually like that visual feedback.
This fix also has a positive effect on the `yf` command when copying
`contenteditable` elements. Take this markup:
<div contenteditable="true">T</div>
Then type `<backspace>one<enter><enter>two` in it. Finally, copy the
element using `yf`.