Comments on: Subclassing jQuery https://j11y.io/javascript/subclassing-jquery/ Sun, 22 Mar 2015 15:39:22 +0000 hourly 1 https://wordpress.org/?v=5.0.13 By: martin Varesio https://j11y.io/javascript/subclassing-jquery/#comment-2169 Wed, 29 Feb 2012 13:09:46 +0000 https://j11y.io/?p=1859#comment-2169 Here
function Planet() {
//.+ Implement planet logic
}

Planet.prototype = jQuery([]);

]]>
By: Mike https://j11y.io/javascript/subclassing-jquery/#comment-2168 Sat, 08 Oct 2011 16:43:44 +0000 https://j11y.io/?p=1859#comment-2168 How about using jQueryUI.widget (http://wiki.jqueryui.com/w/page/12138135/Widget-factory)? Here is a quote from the that wiki page:
“It is designed not only for plugins that are part of jQuery UI, but for general consumption by developers who want to create object-oriented components without reinventing common infrastructure.”

This is exactly what you wanted to achieve here. I have used it before, and it makes it really easy to create a stateful ui components. So the tool tip example could have been easily made using the widget factory class.

]]>
By: Romain https://j11y.io/javascript/subclassing-jquery/#comment-2167 Mon, 12 Sep 2011 23:32:27 +0000 https://j11y.io/?p=1859#comment-2167 “@Nik: All said, very interesting plugin, I guess this will be more middle ground between jQuery spaghetti and Backbone/knockout/javascriptmvc.”

That’s exactly how I see it too. I guess it can be helpful for little apps/widgets which do not need the whole Backbone logic and weight (not to mention _.js).

]]>
By: naugtur https://j11y.io/javascript/subclassing-jquery/#comment-2166 Mon, 12 Sep 2011 06:58:57 +0000 https://j11y.io/?p=1859#comment-2166 I like your jquery hacks. I’m not sure if I’ll use what you posted here, but I really enjoy your ideas to do something new and hacky with jquery. I’m a fan of that since jquery.single 🙂

]]>
By: Nik https://j11y.io/javascript/subclassing-jquery/#comment-2165 Mon, 12 Sep 2011 03:23:03 +0000 https://j11y.io/?p=1859#comment-2165 all right, just previewed my comment, I meant “it’s *NOT* like the more separation the merrier…” and I dislike injecting html elements so directly from javascript.

]]>
By: Nik https://j11y.io/javascript/subclassing-jquery/#comment-2164 Mon, 12 Sep 2011 03:21:25 +0000 https://j11y.io/?p=1859#comment-2164 So is the purpose of this plugin to do better interface element creation/modification?

I’ve been digging deep into Backbone.js these days. And its philosophy seems to be User Interaction -> DOM event listener -> Data modification callbacks -> More other data modification callbacks if needed -> interface updates signals -> populate javascript template like ERB -> update interface.

I think this is the ultimate separation. I know it’s know like the more separation the merrier. But I have something really against doing anything like append(‘…’).

All said, very interesting plugin, I guess this will be more middle ground between jQuery spaghetti and Backbone/knockout/javascriptmvc.

]]>
By: Misha Reyzlin https://j11y.io/javascript/subclassing-jquery/#comment-2163 Sun, 11 Sep 2011 20:20:07 +0000 https://j11y.io/?p=1859#comment-2163 Hey, what about doing something like:

function Foo() {
    this.name = 'foo';
    this.setDOM('');
}
 
$.extend( Foo.prototype, new jQuery.Interface, { // more prototype methods } );

So Foo preserves .constructor

]]>