Ticket #10943 (closed bug: fixed)
JQuery 1.7.1 does not properly set tabindex property on cloned element in IE7
| Reported by: | M8R-xm2ocg@… | Owned by: | mikesherov |
|---|---|---|---|
| Priority: | low | Milestone: | 1.8.3 |
| Component: | attributes | Version: | 1.7.1 |
| Keywords: | ie7 clone | Cc: | |
| Blocking: | Blocked by: |
Description
JQuery 1.7.1 does not properly set tabindex property on cloned element in IE7. This works in both Firefox and Chrome. It also works in IE7 when using jQuery 1.6.2.
Steps To Reproduce: Click each button in order from left to right, noting the tab order after each click.
<html>
<head>
<!-- <script type="text/javascript" src="jquery-1.6.2.min.js"></script> -->
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript">
var indexOrder = new Array(1, 3, 5, 2, 4);
$(function() {
$("#crazyTabIndexButton").click(function(event) {
event.preventDefault();
setCrazyTabIndexes($(this).parents("form"));
});
$("#cloneButton").click(function(event) {
event.preventDefault();
var clone = $("form").filter(":first").clone();
$("#formContainer").append(clone);
});
$("#resetUsingJqueryButton").click(function(event) {
event.preventDefault();
resetTabIndexesUsingJquery();
});
$("#resetUsingJavascriptButton").click(function(event) {
event.preventDefault();
resetTabIndexesUsingJs();
});
});
function setCrazyTabIndexes() {
$("form :input").each(function(index, input) {
$(input).prop("tabindex", indexOrder[index]);
});
}
function resetTabIndexesUsingJquery() {
var newIndex = 0;
$("form :input").each(function(index, input) {
$(input).prop("tabindex", ++newIndex);
});
}
function resetTabIndexesUsingJs() {
var newIndex = 0;
$("form :input").each(function(index, input) {
input.setAttribute("tabIndex", ++newIndex);
});
}
</script>
</head>
<body>
<h3>JQuery 1.7.1 does not properly set tabindex property on cloned element in IE7</h3>
Steps To Reproduce: Click each button in order from left to right, noting the tab order after each click.
<br/><br/>
<button id="crazyTabIndexButton">Set Crazy Tab Indexes</button>
<button id="cloneButton">Clone Form</button>
<button id="resetUsingJqueryButton">Reset Tab Indexes using JQuery</button>
<button id="resetUsingJavascriptButton">Reset Tab Indexes Using Plain JS</button>
<div id="formContainer">
<form>
<div>0: <input type="text" /></div>
<div>1: <input type="text" /></div>
<div>2: <input type="text" /></div>
<div>3: <input type="text" /></div>
<div>4: <input type="text" /></div>
</form>
</div>
</body>
</html>
Change History
comment:2 Changed 18 months ago by sindresorhus
- Priority changed from undecided to low
- Status changed from new to open
- Component changed from unfiled to attributes
jQuery successfully clones the elements tabIndex, but is not able to set the "tabindex" on the cloned elements in IE7.
This problem is only apparent in the real IE7, not IETester or IE7 mode in IE8/9.
comment:4 Changed 9 months ago by mikesherov
- Owner set to mikesherov
- Status changed from open to assigned
- Milestone changed from None to 1.8
This was inadvertently fixed by https://github.com/jquery/jquery/commit/3e2a77c5e882b5fc88bf5469ea00067833a2a059 in 1.8.
timmywil, do we need a unit test for this? If so, I'll write one. Otherwise, I can close.
comment:7 Changed 8 months ago by Mike Sherov
- Status changed from assigned to closed
- Resolution set to fixed
Fix #10943, tabindex not set properly on clone in IE7. Close gh-937.
This is only a unit test fix because the bug was tangentially fixed by a different commit
Changeset: f9ef91d6d68dc7317bb12c1ae2a8201f28facff1
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

http://jsfiddle.net/VauK7/