Bug Tracker

Modify

Ticket #3904 (closed bug: worksforme)

Opened 4 years ago

Last modified 14 months ago

$('<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:1 Changed 4 years ago by dmethvin

  • Component changed from unfilled to core

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.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.