Modify ↓
Ticket #10724 (closed bug: fixed)
$(document).text() always returns an empty string
| Reported by: | madblueimp | Owned by: | timmywil |
|---|---|---|---|
| Priority: | high | Milestone: | 1.7.1 |
| Component: | attributes | Version: | 1.7 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I'm not sure if .text() is supposed to work on the document element, but the following code used to work on prior versions, but always returns an empty string with jQuery 1.7:
var textContent = $(document).text();
Change History
comment:1 Changed 19 months ago by rwaldron
- Owner set to timmywil
- Priority changed from undecided to high
- Status changed from new to assigned
- Component changed from unfiled to attributes
comment:2 Changed 19 months ago by dmethvin
- Milestone changed from None to 1.7.1
It's the new Sizzle.getText, it gets a jQuery collection array from jQuery.fn.text that is just the document element and falls into the wrong case. (A document is 9 btw).
comment:3 Changed 19 months ago by timmywil
- Status changed from assigned to closed
- Resolution set to fixed
Update Sizzle. Adds document to acceptable nodeTypes for .text(). Fixes #10724.
Changeset: 0cc806fd88c4dadb0904c7d0b68014520ff668b9
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.

Confirmed
http://jsfiddle.net/rwaldron/v9jUX/