Side navigation
#4548 closed bug (duplicate)
Opened April 16, 2009 04:38PM UTC
Closed February 18, 2011 01:42PM UTC
Last modified February 18, 2011 01:42PM UTC
jquery.text bug
Reported by: | jidixuelang | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | manipulation | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
[code]
alert($('title').text());
As using 'jquery.text' to fetch the text of document.title,I will get nothing with IE!
But work fine,when i use firefox or chrome!
I see,IE has a question at the realization of title-node.
Executeing the following code with IE,i will get zero.However,the 'one' is expected and truly at the other browser!
[code]
document.getElementsByTagName('title')[0].childNodes.length
Also , I find modifing the source code of jquery can avoid this question,Only with which part about 'jquery.text'.
[code]
/** @id jQuery.text **/
text: function( text ) {
if ( typeof text != "object" && text != null )
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
var ret = "";
jQuery.each( text || this, function(){
ret += this.innerText!=undefined?
this.innerText:this.textContent!=undefined?
this.textContent:'';
});
return ret;
},
So i think this problem maybe has the better one resolvent!
Attachments (0)
Change History (5)
Changed April 16, 2009 04:45PM UTC by comment:1
Changed June 12, 2010 03:58AM UTC by comment:2
resolution: | → worksforme |
---|---|
status: | new → closed |
The cross-browser way to get a document's title is the
document.titleproperty.
Changed February 18, 2011 01:42PM UTC by comment:3
component: | unfiled → manipulation |
---|---|
keywords: | jquery.text |
milestone: | 1.3.2 |
priority: | major → low |
resolution: | worksforme |
status: | closed → reopened |
Changed February 18, 2011 01:42PM UTC by comment:4
resolution: | → duplicate |
---|---|
status: | reopened → closed |
As the format is bad, I rewrite the above content!
--code start--
alert($('title').text());
--code end--
As using 'jquery.text' to fetch the text of document.title,I will get nothing with IE!
But work fine,when i use firefox or chrome!
I see,IE has a question at the realization of title-node.
Executeing the following code with IE,i will get zero.However,the 'one' is expected and truly at the other browser!
--code start--
document.getElementsByTagName('title')[0].childNodes.length
--code end--
Also , I find modifing the source code of jquery can avoid this question,Only with which part about 'jquery.text'.
--code start--
/** @id jQuery.text **/
text: function( text ) {
if ( typeof text != "object" && text != null )
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
var ret = "";
jQuery.each( text || this, function(){
ret += this.innerText!=undefined?
this.innerText:this.textContent!=undefined?
this.textContent:'';
});
return ret;
},
--code end--
So i think this problem maybe has the better one resolvent!