Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11046 closed bug (wontfix)

.text() property strips whitespace on IE 8

Reported by: [email protected] Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:


The following snippet: $('<h1><div>sub</div> title</h1>').text();

Correctly returns: "sub title" on Chrome, FireFox and IE9.

But on IE 8 it returns: "subtitle"

Change History (3)

comment:2 Changed 11 years ago by Rick Waldron

Resolution: wontfix
Status: newclosed


Unlike the .html() method, .text() can be used in both XML and HTML documents. The result of the .text() method is a string containing the combined text of all matched elements. (Due to variations in the HTML parsers in different browsers, the text returned may vary in newlines and other white space.) Consider the following HTML

comment:3 Changed 11 years ago by dmethvin

Just so you know it isn't jQuery doing the mangling:


IE8 and lower in particular likes to do strange things with whitespace.

Note: See TracTickets for help on using tickets.