Skip to main content

Bug Tracker

Side navigation

#3053 closed bug (fixed)

Opened June 17, 2008 04:14AM UTC

Closed June 17, 2008 07:59PM UTC

Last modified July 18, 2008 11:38AM UTC

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:
Blocked by: Blocking:
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;

Attachments (0)
Change History (4)

Changed June 17, 2008 07:59PM UTC by flesler comment:1

need: ReviewCommit
owner: → flesler
priority: majorminor
status: newassigned

Changed June 17, 2008 07:59PM UTC by flesler comment:2

resolution: → fixed
status: assignedclosed

Fixed at [5728] and added tests at [5729].

Changed July 18, 2008 11:36AM UTC by jhooks@scrin comment:3

would 'if (elem == undefined)' be a better fix?

Is it also be worth changing the !elem in trigger() for the sake of consistency, even if elem in trigger will never === 0

Changed July 18, 2008 11:38AM UTC by jhooks@scrin comment:4

--oops forgot to preview

c/also be worth/also worth/