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

inherit from jQuery #28

Open
tj opened this issue Feb 5, 2012 · 3 comments
Open

inherit from jQuery #28

tj opened this issue Feb 5, 2012 · 3 comments

Comments

@tj
Copy link
Member

tj commented Feb 5, 2012

not sure if jquery really facilitates this, will have to take a look but it would be nicer to have button.appendTo(something) vs button.el.appendTo(something)

@sjonnet19
Copy link

If u mean to expose a helper for appending ur button element onto another element.

http://api.jquery.com/appendTo/

@tj
Copy link
Member Author

tj commented Feb 5, 2012

I just mean inheriting from the jQuery prototype so I don't have to duplicate any of those methods and dont have to make .el public api

@tj tj closed this as completed Feb 5, 2012
@tj tj reopened this Feb 5, 2012
@sjonnet19
Copy link

Looking at some of your code, .appendTo would already be available.

this.el = $(html)
this.el = $(this.template)

The $.fn is just really an alias the jquery's prototype. I'm not sure how you might shoe horn your api together with jQuery.

$.fn.button = function (option) {
    return this.each(function () {
        new Button(...)
    })
}

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

2 participants