Modify ↓
Ticket #3904 (closed bug: worksforme)
$('<span> </span>') ie bug - jQuery 1.2.6 & 1.3 both
| Reported by: | MarionNewlevant | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.3.1 |
| Component: | core | Version: | 1.3 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
$('<span> </span>').contents().length is 1 in firefox and safari, 0 in ie (6 & 7). (maybe hard to read: this is a span containing a single space) I have a work-around: $('<span/>').text(' ').contents().length is 1 everywhere.
jQuery 1.2.6 & 1.3 both.
Change History
comment:2 Changed 3 years ago by dmethvin
- Status changed from new to closed
- Resolution set to worksforme
That's actually the way contents() works:
http://api.jquery.com/contents/
As .html() mentions, browsers don't always treat white space the exact same way. That's outside the control of jQuery though.
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.
