Skip to content

Unclear best-practices guidelines in Advanced Plugin Concepts #513

Closed
@teo1978

Description

@teo1978

http://learn.jquery.com/plugins/advanced-plugin-concepts/#give-full-control-of-elements

I had a hard time figuring out what this section was trying to highlight.

The confusing part is where it says:

"A bad implementation: "

    // Plugin code:
       ....actual code
    // Retain an internal reference:
       ....actual code

That looks like the whole block of code (including two parts with heading comments) is supposed to be the example of bad implementation (and the code doesn't make much sense alltogether), and then one expects the rest of the text to explain what's wrong in it and how to improve it.

Instead, the first part of the code under the comment "//Plugin code" is the bad implementation, and the second part starting with the comment "//Retain an internal reference:" is already the improved code that replaces the previous one. That's not clear at all.

This could be improved for example like this:

"""
A bad implementation:

    // Plugin code:
       ....actual code

A better implementation:

    // Retain an internal reference:
       ....actual code

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