Since V1.26.0, there is a RegExp BUG in IE10/11
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13k
- Forks
- 1.4k
- Avg merge
- 15h 36m
- Merged PRs (30d)
- 3
Description
Information:
- Prism version: V1.26.0+
- Environment: IE10/11 in Windows7/10
Description
V1.25.0 In IE is fine, but Since V1.26.0, IE can't work, the problem is this line :
element.className = element.className.replace(RegExp(lang, 'gi'), '');
Example
Because the type of lang is RexExp, but in IE, RegExp() function, the first parame only can be a String, so it cant't run.
Maybe We can do this to solve it : element.className = element.className.replace(RegExp(String(lang), 'gi'), '');
In addition, the modifier of lang is 'i' : var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;,
but here it is changed to 'gi', I am really worried about whether it will cause an error in some case.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the element.className.replace(RegExp(lang, 'gi'), '') line identified in the issue and inspect how lang is defined and passed in the Prism source. Verify the change against the reported IE10/11 behavior and confirm that language-class removal still works without altering the intended case-insensitive matching.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100