Skip to main content

Bug Tracker

Side navigation

#9227 closed bug (wontfix)

Opened May 11, 2011 05:44AM UTC

Closed December 12, 2012 04:21PM UTC

Can't change the text of option tab cloned by jQuery's clone method(1.5&1.6,Only the select tag in IE6,7,8)

Reported by: syzzzlj@163.com Owned by: rwaldron
Priority: low Milestone: 1.9
Component: manipulation Version: 1.5.2
Keywords: ie7 Cc:
Blocked by: Blocking:
Description

the html tags is as:

<select>

<option value="good">good</option>

<option value="good1">good1</option>

<option value="good2">good2</option>

<option value="good3">good3</option>

<option value="good4">good4</option>

</select>

my codes is as:

var obj = $("select");

var temp = obj.clone(true);

$("body").append(temp);

$("option").each(function(){

$(this).text("dddd");

});

If you run it,you will watch, the original tag's text changed,bug the cloned option tags' texts can't change.

In IE8, with the Developer's tools,you can see, the text has changed, but users can't see the changed text, they only can see the old text;

Attachments (0)
Change History (19)

Changed May 11, 2011 06:30AM UTC by anonymous comment:1

sorry,the codes is not right.

The real codes is

var obj = $("select");

var temp = obj.clone(true);

$("body").append(temp);

$("select").each(function(){

$(this).find("option").each(function(){

$(this).text("dddd");

});

});

Then, you can't change the Text!

Changed May 11, 2011 06:33AM UTC by syzzzlj@163.com comment:2

There is another bug,.

If you bind a change Event to the first select tag, after clone, the cloned tag's change Event will be trigger twice;

Changed May 11, 2011 02:57PM UTC by timmywil comment:3

component: unfiledmanipulation
owner: → syzzzlj@163.com
priority: undecidedlow
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case on http://jsfiddle.net that reproduces the issue experienced to help us assess your ticket.

Additionally, test against the jQuery (edge) version to ensure the issue still exists.

Changed May 13, 2011 02:28AM UTC by syzzzlj@163.com comment:4

status: pendingnew

The text case url is http://jsfiddle.net/LT5aE/1/

(Only IE 6,7,8 has this bug, I don't know whether IE9 has;)

Changed May 13, 2011 02:42AM UTC by rwaldron comment:5

owner: syzzzlj@163.comrwaldron
status: newassigned

Changed May 13, 2011 02:42AM UTC by rwaldron comment:6

priority: lowhigh

Changed July 01, 2011 07:31AM UTC by syzzzlj@163.com comment:7

jQuery1.6.2 also has this bug!!!

Changed July 03, 2011 07:23AM UTC by anonymous comment:8

this haven't solve yet

Changed July 03, 2011 02:11PM UTC by rwaldron comment:9

I'll get this patched within the next day

Changed July 12, 2011 07:50PM UTC by rwaldron comment:10

Reduction with clearer details: http://jsfiddle.net/rwaldron/UgV89/

Changed July 27, 2011 04:33PM UTC by syzzzlj comment:11

I'll download the new version and watch whether has this problem

Changed July 27, 2011 04:43PM UTC by syzzzlj@163.com comment:12

I'm sorry, the problem is still there, and your test case also!

Please run it in IE, and you can see the problem!

Changed September 08, 2011 05:32PM UTC by syzzzl@163.com comment:13

from your log that'is right,but please watch the page.Yes, the text is changed, I can watch the changed text by debug tools, but user can't see the changed text,they can only see the original text!

Changed November 18, 2011 02:32AM UTC by syzzzlj comment:14

The problem is still there!(1.7)

Changed January 12, 2012 12:46PM UTC by syzzzlj@163.com comment:15

Because of IE's bug,so jQuery has this bug.But,in version 1.4.2, the method is very well, why you don't use it?

Changed March 03, 2012 09:45PM UTC by dmethvin comment:16

keywords: → ie7
priority: highlow

Assigning to the option.text property is the only thing that seems to work, not even innerText updates it. (Remember new Option(text, value) for creating option elements?) This would need to be hard wired into jQuery.fn.text I suppose?

http://jsfiddle.net/UgV89/11/

Changed June 26, 2012 02:43AM UTC by dmethvin comment:17

It occurs to me this is another manifestation of the bizarro IE7 issues with cloned attroperty values, like #9905 and #10943. We haven't determined a generalized fix for the problem, my suggested solution above is rather specialized and ugly but should work.

Changed December 04, 2012 05:48AM UTC by gibson042 comment:18

milestone: 1.next1.9

Changed December 12, 2012 04:21PM UTC by dmethvin comment:19

resolution: → wontfix
status: assignedclosed

We decided not to attempt shimming jQuery.text for these cases for performance and size issues. The workaround mentioned above works across all browsers if you need it. http://jsfiddle.net/UgV89/14/