Opened 11 years ago
Closed 11 years ago
#11962 closed bug (fixed)
Standardize getter return values for empty sets.
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 )
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 (3)
comment:1 Changed 11 years ago by
Description: | modified (diff) |
---|---|
Summary: | Standardize getter return values on empty set. → Standardize getter return values for empty sets. |
comment:2 Changed 11 years ago by
Component: | unfiled → attributes |
---|---|
Milestone: | None → 1.8 |
Priority: | undecided → low |
Status: | new → open |
comment:3 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Fix #11962. Standardize getter return values for empty sets.
Changeset: 21b0db7993315f0a5390798fefe63eb21891493e
Note: See
TracTickets for help on using
tickets.
I'd prefer
undefined
since that changes fewer cases and avoids theObject
-ness ofnull
. Neither.html
nor.offset
have documented returns for empty sets so it should be safe to change. No way we're messing with.text
buddy. :)