Bug Tracker

Opened 9 years ago

Last modified 9 years ago

#11962 closed bug

Standardize getter return values on empty set. — at Initial Version

Reported by: cowboy Owned by:
Priority: low Milestone: 1.8
Component: attributes Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

Description

Just like getter-setter detection logic has been standardized on arguments, it might be a good idea for empty-set getters to always return a consistent value. I vote for null.

I also understand if .text() must continue to behave differently, because it's already a special case in other ways, and we need something to laugh at ironically.

$.fn.jquery   // "1.7.2"
$().attr("x") // undefined
$().prop("x") // undefined
$().css("x")  // undefined
$().val()     // undefined
$().text()    // ""
$().html()    // null
$().offset()  // null

Please don't do this in a patch release, though! <3

Change History (0)

Note: See TracTickets for help on using tickets.