Bug Tracker

Opened 9 years ago

Last modified 9 years ago

#11962 closed bug

Standardize getter return values for empty sets. — at Version 1

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

Description (last modified by cowboy)

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

Change History (1)

comment:1 Changed 9 years ago by cowboy

Description: modified (diff)
Summary: Standardize getter return values on empty set.Standardize getter return values for empty sets.
Note: See TracTickets for help on using tickets.