Skip to content

Docs for .data("key", undefined) are incorrect #586

@rwaldron

Description

@rwaldron

Originally reported by @vizmo here: jquery/jquery#1852

Re: http://api.jquery.com/data/

The incorrect bullet item:

undefined is not recognised as a data value. Calls such as .data( "name", undefined ) will return the corresponding data for "name", and is therefore the same as .data( "name" ).

The correction:

undefined is not recognised as a data value. Calls such as .data( "name", undefined ) will return the jQuery instance object that it was called on, which allows for method chaining. (Or something similar)

The correct behavior is supported by tests in the data test suite. https://github.com/jquery/jquery/blob/master/test/unit/data.js#L232

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions