feathericons / feather

Simply beautiful open-source icons
https://feathericons.com
MIT License
24.84k stars 1.22k forks source link

Error when <i> attribute contains "&" #973

Open AdamGaskins opened 3 years ago

AdamGaskins commented 3 years ago

Prerequisites

Step to reproduce

  1. Start with a normal data-feather element: <i data-feather="award"></i>.
  2. Run in a script tag: feather.replace()
  3. To cause the error, add any attribute to the icon element where the value contains an & symbol: <i data-feather="award" title="Mac & Cheese"></i>. Replacing the & with &amp; does not fix the issue.

Example: https://jsfiddle.net/jsd2tb0q/1/

Actual behavior:

I would expect this to not error.

Any message or error

replace.js:45 Uncaught TypeError: Failed to execute 'replaceChild' on 'Node': parameter 1 is not of type 'Node'. at replace.js:45 at replace.js:19 at Array.forEach () at Object.n.default [as replace] (replace.js:18) at ?editor_console=:106

Resources

Olyno commented 3 years ago

Hi 👋🏻 I would like to add another way to reproduce it: using any tag and a class name with specific character, the < character. I'm using this character with WindiCSS (tailwind alternative)

AdamGaskins commented 3 years ago

@Olyno I made a PR to fix this almost a year ago but the maintainers seem to be inactive.. i've since switched to https://lucide.dev/ which is a fork of feathericons that has this issue fixed!

nandha46 commented 1 year ago

This error occurs when using these symbols too. ? < =