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

Avoid errors with undefined populator, selector #41

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

Conversation

izak
Copy link

@izak izak commented May 28, 2013

For reasons I could not determine, and which disappear whenever you add a
debugger to the mix (that is, it is a race condition), The populator and helper
members are sometimes undefined causing errors. In addition, this code makes
sure we don't get the entire hierarchy if more than one parent matches
the selector, for we most certainly don't want more than one popup.

izak added 2 commits May 28, 2013 13:42
For reasons I could not determine, and which disappear whenever you add a
debugger to the mix (that is, it is a race condition), The populator and helper
members are sometimes undefined causing errors. In addition, this code makes
sure we don't get the entire hierarchy if more than one parent matches
the selector, for we most certainly don't want more than one popup.

Fixes alohaeditor#408.
# Hide all popovers except for the current one maybe?
$el = jQuery(rangeObject.getCommonAncestorContainer())
$el = $el.parents(helper.selector) if not $el.is(helper.selector)
$el = $el.parents(helper.selector).eq(0) if not $el.is(helper.selector)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for .eq(0) instead of .first()?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing specific, I just don't have first() near the top of my mental cheatsheet :-) Isn't it the same thing anyway? first() probably reads easier though.

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.

2 participants