Bug Tracker

Opened 11 years ago

Closed 11 years ago

#11692 closed bug (invalid)

Passing "null" (or an undifined variable) to the text- and html-methods fires them as setters.

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:


In previous versions of jQuery, passing "null" (or an undefined variable) to the text- and html-methods fired them as a getter, returning the text.
In version 1.7.2 (and possibly 1.7.1 and 1.7.0), passing "null" (or an undefined variable) fires the methods as a setter, returning the jQuery-object it is fired on.

Kind of breaks my plugin...

Change History (1)

comment:1 Changed 11 years ago by dmethvin

Resolution: invalid
Status: newclosed

Sorry but that was undocumented behavior. As of jQuery 1.7.2, all plugins that are getter/setter are consistent. If you pass two arguments it is a setter. There were only a few places where we documented what undefined or null did, and those resolved in favor of being setters, e.g., .val().

Note: See TracTickets for help on using tickets.