Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make onHighlight() add to an array of callbacks rather than overwriting previous #128

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yozlet
Copy link

@yozlet yozlet commented Jun 24, 2013

I ran into the need for this when using one of the line-numbering extensions, but also needed to add an onHighlight callback of my own; I couldn't get the two to co-exist. AFAIK, most onEvent handlers (e.g. those in jQuery) allow multiple callbacks to be piled onto the same event, so this brings Rainbow more in line with that style. However, it may result in an incompatible change if anyone expects onHighlight() to overwrite the previous callback.

@yozlet
Copy link
Author

yozlet commented Jun 24, 2013

Looks like this needs more work. The biggest of several problems is that a registered callback may receive a "block" DOM node that has already been detached from the document by a previous callback. I'm not sure that this invalidates my change, but it certainly makes writing callbacks more difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant