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

Suggestion: deprecate this.$node #302

Closed
necolas opened this issue Aug 19, 2014 · 14 comments
Closed

Suggestion: deprecate this.$node #302

necolas opened this issue Aug 19, 2014 · 14 comments
Milestone

Comments

@necolas
Copy link
Contributor

necolas commented Aug 19, 2014

If there's still interest in eventually not depending on jQuery, this might be worth deprecating now as it seems to be the only place where we expose a jQuery wrapped object from the Flight API itself.

@giuseppeg
Copy link
Contributor

+1

@kbingman
Copy link

Not depending on jQuery would be great. +1

@margaritis
Copy link
Contributor

+1

@BugiDev
Copy link

BugiDev commented Sep 5, 2014

+1
But i have a question, is there a way to get the selector which the component is attached to from inside the component?
In my app, i need to have the reference to node object of the component.

@giuseppeg
Copy link
Contributor

@BugiDev no. You already have this.node though

@nkzawa
Copy link

nkzawa commented Sep 5, 2014

What about this.select which returns a jQuery object?

@giuseppeg
Copy link
Contributor

@nkzawa it'll return a NodeList I suppose that you can still convert to a jQuery object if you decide to use jQuery in your project

@nkzawa
Copy link

nkzawa commented Sep 5, 2014

@giuseppeg Yeah, but that will break backward compatibility. We need a new method for that.

@giuseppeg
Copy link
Contributor

@nkzawa it should be fairly easy to use advice to write a withJQuery mixin.

function withJQuery() {
  // define this.$node
  this.after('initialize', function () {
    this.$node = $(this.node);
  });

  // wrapper for select to return jQuery objects
  this.around('select', function (select) {
    return $(select([].slice.call(arguments, -1)));
  });
}

That you can manually mix with a component:

// Must be the first mixin
var MyComponent = flight.component(withJQuery, function () {});

Or we could decide to hook into the registry and do that automatically for you.

@nkzawa
Copy link

nkzawa commented Sep 5, 2014

@giuseppeg It sounds great!

@karlhp
Copy link

karlhp commented Sep 11, 2014

+1

@tgvashworth
Copy link
Contributor

This is closely related to #320, and will probably be fixed by that.

@tgvashworth tgvashworth added this to the 2.0.0 milestone Jan 14, 2015
@giuseppeg
Copy link
Contributor

@PhUU you can close this I guess

@tgvashworth
Copy link
Contributor

Yep! Woohoo.

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

No branches or pull requests

8 participants