Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#5005 closed bug (duplicate)

jQuery 1.3.2 and nightly HTML title change bug in IE8

Reported by: mrsugar Owned by:
Priority: low Milestone:
Component: manipulation Version: 1.3.2
Keywords: ie8 html title unexpected call to method Cc:
Blocked by: Blocking:

Description

Hi guys,

I was working on changing html title via a small script using this following method:

$("html title").html(docTitle+" | "+currentTitle);

That throw an "unexpected call to method or property access" error in IE8. After switching the method to:

document.title = docTitle+" | "+currentTitle;

The error went away. Not sure if this is IE or Jquery.

Change History (5)

comment:1 Changed 10 years ago by matthawke

I experienced a similar issue today in IE8 with the following code:

$("title").html("Lorem ipsum");

Using jQuery unminified rev 6246 I tracked the error down to the append: function on lines 252-257. Turns out that when the tagName is TITLE, line 255 throws an error.

The original function is:

append: function() {
	return this.domManip(arguments, true, function(elem){
		if (this.nodeType == 1)
			this.appendChild( elem );
	});
},

I edited the function (naturally, thereby killing the functionality with respect to titles) and made the error go away:

append: function() {
	return this.domManip(arguments, true, function(elem){
		if (this.nodeType == 1 && this.tagName != "TITLE")
			this.appendChild( elem );
	});
},

document.title = "Lorem Ipsum" does indeed work correctly.

Hope that helps...

comment:2 Changed 9 years ago by dmethvin

Resolution: worksforme
Status: newclosed

The correct cross-browser way to alter the title is by assigning to the document.title property.

comment:3 Changed 9 years ago by jitter

Component: unfiledmanipulation
Milestone: 1.3.2
Priority: minorlow
Resolution: worksforme
Status: closedreopened

comment:4 Changed 9 years ago by jitter

Resolution: duplicate
Status: reopenedclosed

comment:5 Changed 9 years ago by jitter

Duplicate of #2755.

Note: See TracTickets for help on using tickets.