garysieling / garysieling/jquery-highlighttextarea

Replace mechanism is broken causing misplaced highlights.

Open
#74 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
157
Forks
72
PR merge metrics
No merged PRs in 30d

Description

As you can see from the code, the 'highlight' method replaces each word instance with a element which has a different background making the word highlighted.

The problem is that the 'replace' mechanism is broken and it replaces the words even if they are inside an html element, thus messing up the UI entirely.
So if, for example, one of the words is "background", it would inject a element instead of every "background" including the one in the style of the previous element.
See video and screenshot:

![1](https://cloud.githubusercontent.com/assets/14070203/19973392/c1f01872-a1ed-11e6-8dd2-cded404bff3a.gif)

![screen shot 2016-11-03 at 17 51 55](https://cloud.githubusercontent.com/assets/14070203/19973574/44121c74-a1ee-11e6-8a91-5a5b415d28ca.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.