Skip to main content

Bug Tracker

Side navigation

#6486 closed bug (duplicate)

Opened April 27, 2010 01:02AM UTC

Closed November 19, 2010 08:11AM UTC

Last modified March 09, 2012 06:31AM UTC

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:
Blocked by: Blocking:
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 (1)
  • ie8-test.html (1.0 KB) - added by keith bentrup April 27, 2010 01:02AM UTC.

    cloning checkbox behavior test

Change History (6)

Changed April 27, 2010 01:04AM UTC by keith bentrup comment:1

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

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

// some code

}

Changed April 27, 2010 01:06AM UTC by keith bentrup comment:2

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

Changed April 27, 2010 01:25AM UTC by keith bentrup comment:3

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

Changed November 12, 2010 02:40AM UTC by snover comment:4

milestone: 1.4.3

Resetting milestone to future.

Changed November 19, 2010 08:11AM UTC by snover comment:5

priority: → undecided
resolution: → duplicate
status: newclosed

Changed November 19, 2010 08:11AM UTC by snover comment:6

Duplicate of #3879.