Opened 11 years ago
Closed 11 years ago
#11492 closed bug (wontfix)
In IE8 .append does not append option elements correctly
Reported by: | tentonaxe | Owned by: | Rick Waldron |
---|---|---|---|
Priority: | high | Milestone: | 1.8 |
Component: | manipulation | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When appending options to a select in IE8 with new Option, the option gets appended to the select without a label.
var sel = $("select"); for (var i = 1; i <= 50; i++) { sel.append(new Option(i,i)); }
Here's a workaround to the problem:
var sel = $("select"); for (var i = 1; i <= 50; i++) { var temp = new Option(i,i); sel[0].options[sel[0].options.length] = temp; }
Related SO question: http://stackoverflow.com/questions/9778469/jquery-1-7-working-differently-in-ie8-and-ie9/9778512#comment12465790_9778512
Change History (4)
comment:1 Changed 11 years ago by
Component: | unfiled → manipulation |
---|---|
Priority: | undecided → low |
comment:2 Changed 11 years ago by
Milestone: | None → 1.8 |
---|---|
Owner: | set to Rick Waldron |
Priority: | low → high |
Status: | new → assigned |
comment:3 Changed 11 years ago by
More references
http://msdn.microsoft.com/en-us/library/ms535921(v=vs.85).aspx
comment:4 Changed 11 years ago by
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
This seems sufficiently obscure that we should just call it a wontfix. If it was a serious problem we'd have heard about it earlier. Heck, most web developers today don't know about new Option
I bet.
Here is a screen shot from the IE8 debugger showing the result of new Option("arf", "dog")
without inserting it into the document. You can see it has inconsistent state. Note in particular that the outerHTML value is missing its text/label. http://i.imgur.com/ZSoQD.png
Yes it could be fixed but no it isn't worth the bytes since there are multiple simple workarounds.
Creating with a string of markup works correctly:
http://jsfiddle.net/rwaldron/7qfhg/5/show/light