Modify ↓
Ticket #3053 (closed bug: fixed)
passing Number(0) to html fails.
| Reported by: | Morgan | Owned by: | flesler |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.3 |
| Component: | core | Version: | 1.2.6 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
From the jquery-en mailing.
---
When I call html(5) it will set the innerHtml of my element(s) to "5".
However, zero seems to work differently. When I call html(0), it
removes the contents of my element(s) and does not append anything. I
had hoped after a call to html(0), that html() would return "0".
Is this the expected behavior, or is this a bug?
Thanks,
Lowell
---
I tracked it down to the clean function. On line 946 there is if(!elem), which fails with zero.
Quick patch:
if(!elem && elem !== 0)
return;
Change History
comment:1 Changed 5 years ago by flesler
- need changed from Review to Commit
- Owner set to flesler
- Status changed from new to assigned
- Priority changed from major to minor
comment:2 Changed 5 years ago by flesler
- Status changed from assigned to closed
- Resolution set to fixed
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.
