Bug Tracker

Ticket #6486 (closed bug: duplicate)

Opened 5 years ago

Last modified 3 years ago

Cloning does not maintain checked state of checkboxes in IE8 standards mode.

Reported by: keith bentrup Owned by:
Priority: undecided Milestone:
Component: manipulation Version: 1.4.2
Keywords: ie8 standards mode checkbox Cc:
Blocking: Blocked by:

Description

In IE8 standards mode, if a user checks a checkbox and then that item is cloned, the checked state is not preserved. The problem is with the outerHTML value returned by the element and the method of cloning. A check for the documentMode can be used to correct the behavior.

Attachments

ie8-test.html Download (1.0 KB) - added by keith bentrup 5 years ago.
cloning checkbox behavior test

Change History

Changed 5 years ago by keith bentrup

cloning checkbox behavior test

comment:1 Changed 5 years ago by keith bentrup

A useful test in the clone function of manipulation.js might be:

if (document.documentMode && this.checked) {

some code

}

comment:2 Changed 5 years ago by keith bentrup

sorry that should be if (document.documentMode == 8 && this.checked)

comment:3 Changed 5 years ago by keith bentrup

 http://github.com/jquery/jquery/blob/master/src/manipulation.js#L204

// Handle the case in IE 8 where action=/test/> self-closes a tag
.replace(/\=([^="'>\s]+\/)>/g, '="$1">')
.replace(rleadingWhitespace, "")], ownerDocument)[0];

changed to

// Handle the case in IE 8 where action=/test/> self-closes a tag
.replace(/=([^="'>\s]+\/)>/g, '="$1">')
// Handle IE 8 case where initially unchecked checkboxes and radio buttons (now checked) do not clone properly
.replace(/(<input)/i,(document.documentMode == 8 && this.checked ? '$1 checked="checked"' : '$1'))
.replace(rleadingWhitespace, "")], ownerDocument)[0];

comment:4 Changed 4 years ago by snover

  • Milestone 1.4.3 deleted

Resetting milestone to future.

comment:5 Changed 4 years ago by snover

  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to duplicate

comment:6 Changed 4 years ago by snover

Duplicate of #3879.

Note: See TracTickets for help on using tickets.