Skip to content

"Writing Stateful Plugins" tutorial page is misleading about function contexts #441

@sensibleish

Description

@sensibleish

The page at http://learn.jquery.com/plugins/stateful-plugins-with-widget-factory/ contains the phrase:

all functions will be executed within the context of that instance

This is misleading, and there is no further explanation regarding context on the page. If you use the standard jQuery methods (on, bind) to set widget functions as event callbacks, they will be executed with this set to the event target element (just like usual). According to the API docs for Widget Factory, the _on() method is available if you want to avoid the context change. It would be helpful if the tutorial page called this out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions