Skip to main content

Bug Tracker

Side navigation

#11692 closed bug (invalid)

Opened May 03, 2012 09:44PM UTC

Closed May 03, 2012 10:08PM UTC

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:
Description

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...

Attachments (0)
Change History (1)

Changed May 03, 2012 10:08PM UTC by dmethvin comment:1

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().