Brian Hogan explained unobtrusive JavaScript, and in plugin development you need to think about unobtrusive CSS.

TCCC9, jQuery Plugin Development

Thank you to everyone who attended my talk! There were a LOT of great questions, and I just want to follow up on a few things that didn't get into the slides that were asked about. Also, the slides and code links are below.

Now for the questions that were asked. We had a good conversation with regards to the this keyword in plugin development. I'd like to clarify that here.

this

When used inside a plugin, this refers to the jQuery set that you are operating on. Take a look at this example.

When you go over to the console you can see that this is the jQuery set.

However, when you are iterating, this becomes the current DOM element that is used by jQuery. If you want to run jQuery methods on it, you need to pass it to jQuery.

The rule? When inside a plugin, this refers to the passed set, and it is already a jQuery object. When iterating over that set, this becomes the current DOM element in your iteration.

Layers for Layout, Presentation, and Interaction (or behavior)

Brian Hogan explained unobtrusive JavaScript, and in plugin development you need to think about unobtrusive CSS. The CSS that defines how a plugin looks should be placed in an external stylesheet to be included when you distribute your plugin. Exceptions for this include properties that rely on your JavaScript.

Follow-up

That's it for now, but I will be looking into a few more things that came up in my presentation. After I am more familiar with Node, Processing.js, and ExtJS I will blog about those for people who are interested. Also, I was asked about building widgets which I don't have any knowledge of. That may be another blog post.

Once again, thank you to those who attended! I learned a lot preparing for this, and I'm excited to keep working on my presenting skills. I hope everyone learned a great deal about jQuery.

Contact

Follow me on Twitter

Send me an email at godin.aaron@gmail.com.

Go up to the top or back home.