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

Fixing getManagerForEl when root element is provided #232

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

Conversation

fcamblor
Copy link
Contributor

@fcamblor fcamblor commented Oct 24, 2018

When root collection item element is provided to getManagerForEl(), manager is not resolved because of a missing self-check.

Provided a unit test demonstrating the issue.

Note that I re-generated minified version of Backbone.CollectionBinder.js using https://jscompress.com which makes some variable naming changing in the resulting code.

Tell me if :

  • Such minification should not be part of the PR (could be generated at release time)
  • I should use another tool to limit the differences compared to existing minified js file

}

var $el = $(this._el);
return $el.has(findEl).length > 0 || $el.is(findEl);
Copy link
Owner

Choose a reason for hiding this comment

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

Sorry but aren't these 2 statements the same thing?
this._el === findEl
$el.is(findEl)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, that's my concern on root node : they "represent" the same DOM node, but are different instances

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess we could make a single $(this._el)[0] === $(findEl)[0] but this sound a bit hacky

However, I agree we could imagine making a single $el.is(findEl) test (removing this._el === findEl test)

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