h icon indicating copy to clipboard operation
h copied to clipboard

style tag content shouldn't be highlighted\annotated

Open OfirD1 opened this issue 5 years ago • 0 comments
trafficstars

Steps to reproduce

  1. Go to this Wikipedia page (sorry it's Hebrew, but this is where I've encountered the bug).
  2. ctrl+f for the words המצב כך:
  3. With your mouse, select these words along with the first word of the next paragraph, like so: bug )
  4. The highlighted text contains the <style> tag text: image

Expected behaviour

<style> tag content shouldn't be highlighted

Actual behaviour

<style> tag content was highlighted

Browser/system information

Chrome Version 80.0.3987.163 (Official Build) (64-bit), Windows 10

Additional details

I'm not sure it's a valid fix, here's what I did on my local build inside Util.getTextNodes to fix this:

if (node.nodeType !== Util.NodeTypes.COMMENT_NODE &&
    node.nodeName.toLowerCase() !== "style") // <-- added by me

OfirD1 avatar Apr 13 '20 14:04 OfirD1