feathericons / feathericons/feather
Error when <i> attribute contains "&"
- Dominant language
- JavaScript
- Stars
- 26k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
## Prerequisites
* Version: 4.28.0
* Are you running from source/master: No
* Are you using a released build: Yes (CDN and NPM)
* Operating system: macOS 10.15.6
* Bits: 64
## Step to reproduce
1. Start with a normal data-feather element: ``.
2. Run in a script tag: `feather.replace()`
2. To cause the error, add any attribute to the icon element where the value contains an & symbol: ``. Replacing the `&` with `&` 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
* Links
* Screenshots
Contributor guide
Research direction
Start with replace.js at the reported lines 19 and 45, following the feather.replace() path for an icon whose title contains an ampersand. Reproduce the case from the issue or its JSFiddle, then verify that replacement completes without the replaceChild TypeError and preserves the attribute value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- Half a day
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100