Bug Tracker

Opened 9 years ago

Closed 7 years ago

#9227 closed bug (wontfix)

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@… Owned by: Rick Waldron
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;

Change History (19)

comment:1 Changed 9 years ago by anonymous

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!

comment:2 Changed 9 years ago by syzzzlj@…

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;

comment:3 Changed 9 years ago by timmywil

Component: unfiledmanipulation
Owner: set to syzzzlj@…
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.

comment:4 Changed 9 years ago by syzzzlj@…

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;)

comment:5 Changed 9 years ago by Rick Waldron

Owner: changed from syzzzlj@… to Rick Waldron
Status: newassigned

comment:6 Changed 9 years ago by Rick Waldron

Priority: lowhigh

comment:7 in reply to:  6 Changed 8 years ago by syzzzlj@…

jQuery1.6.2 also has this bug!!!

comment:8 Changed 8 years ago by anonymous

this haven't solve yet

comment:9 Changed 8 years ago by Rick Waldron

I'll get this patched within the next day

comment:10 Changed 8 years ago by Rick Waldron

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

comment:11 Changed 8 years ago by syzzzlj

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

comment:12 Changed 8 years ago by syzzzlj@…

I'm sorry, the problem is still there, and your test case also! Please run it in IE, and you can see the problem!

comment:13 Changed 8 years ago by syzzzl@…

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!

comment:14 Changed 8 years ago by syzzzlj

The problem is still there!(1.7)

comment:15 Changed 8 years ago by syzzzlj@…

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?

comment:16 Changed 8 years ago by dmethvin

Keywords: ie7 added
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/

comment:17 Changed 7 years ago by dmethvin

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.

comment:18 Changed 7 years ago by gibson042

Milestone: 1.next1.9

comment:19 Changed 7 years ago by dmethvin

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/

Note: See TracTickets for help on using tickets.