Bug Tracker

Opened 11 years ago

Closed 9 years ago

Last modified 8 years ago

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

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

comment:1 Changed 10 years ago by dmethvin

Component: unfilledcore

comment:2 Changed 9 years ago by dmethvin

Resolution: worksforme
Status: newclosed

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.

Note: See TracTickets for help on using tickets.