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

Determine the correct target before onFilter #157

Merged
merged 2 commits into from
Dec 8, 2014
Merged

Determine the correct target before onFilter #157

merged 2 commits into from
Dec 8, 2014

Conversation

dandv
Copy link
Contributor

@dandv dandv commented Dec 8, 2014

Fix #156 and also returning correct indexes if a drag handle is present (#154).

How does this impact the example code for closest?

@dandv dandv added the question questions from the community label Dec 8, 2014
@dandv
Copy link
Contributor Author

dandv commented Dec 8, 2014

Updated PR with a fix for the index method.

// Check filter
if (typeof filter === 'function') {
if (filter.call(this, target, this)) {
_dispatchEvent(el, 'filter', target);
_dispatchEvent(el, 'filter', target, undefined, startIndex);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is bad, onFilter should to work with evt.target.
Add variable originalTarget:

originalTarget = (touch || evt).target,
target = originalTarget

// ...

_dispatchEvent(el, 'filter', originalTarget, undefined, startIndex);

Copy link
Collaborator

Choose a reason for hiding this comment

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

el -> originalTarget

Copy link
Collaborator

Choose a reason for hiding this comment

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

_dispatchEvent(originalTarget, 'filter', target, undefined, startIndex); ;]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated PR.


// get the index of the dragged element within its parent
startIndex = _index(target);

// Check filter
if (typeof filter === 'function') {
if (filter.call(this, target, this)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

target -> originalTarget

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated PR. Also updated target -> originalTarget after the filter.split(',') line.

Fix #156 and also returning correct indexes if a drag handle is present (#154).
RubaXa added a commit that referenced this pull request Dec 8, 2014
Determine the correct target before onFilter
@RubaXa RubaXa merged commit 6c41dcd into dev Dec 8, 2014
@dandv dandv deleted the fix-156 branch December 8, 2014 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question questions from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants