#7025 closed bug (duplicate)
Method .text() Works in Firefox, Fails in IE
Reported by: | rwadams | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | core | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Test page: http://www.hymntime.com/tch/htm/h/o/template.htm
Lines 91-92 of script hymn2.js read:
var titleElement = $("title");
var titleText = titleElement.text();
This correctly returns the document title in Firefox 3.6.9. However, in Internet Explorer 8.0.7600, the variable titleText is set to an empty string.
Change History (7)
comment:1 follow-up: 2 Changed 12 years ago by
comment:2 Changed 12 years ago by
Replying to miketaylr:
This isn't really a bug, per se--the most reliable way of getting the text from the title across browsers is via document.title.
In your example, var titleText = document.title;
Hmmm...I thought Jquery's goal was to give the same behavior across browsers, especially two major browsers like Firefox & IE? Oh well. I'm still unclear what causes the different results, but you're right: document.title does work. Guess we'll declare victory & let the Jquery folks scratch their heads about the different browser behaviors.
comment:3 Changed 12 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
There already is a cross-browser way to set and get the title, document.title
.
comment:5 Changed 12 years ago by
Component: | unfiled → core |
---|---|
Milestone: | 1.4.3 |
Priority: | → low |
Resolution: | worksforme |
Status: | closed → reopened |
comment:6 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
This isn't really a bug, per se--the most reliable way of getting the text from the title across browsers is via document.title.
In your example, var titleText = document.title;