Skip to main content

Bug Tracker

Side navigation

#4049 closed bug (duplicate)

Opened February 03, 2009 07:13AM UTC

Closed October 03, 2010 02:07AM UTC

Cannot set checkboxes in strict XHTML

Reported by: gglockner Owned by: john
Priority: major Milestone: 1.3.2
Component: data Version: 1.3.1
Keywords: Cc:
Blocked by: Blocking:
Description

Suppose you have a strict XHTML page in jQuery 1.3.1, and suppose the DOM contains a checkbox. If you try to set the state of the checkbox via $("#c").attr("checked","checked") or clear it with $("#c").removeAttr("checked"), the state of the checkbox is not affected.

This affects Webkit and Firefox.

A detailed example can be found at:

http://groups.google.com/group/jquery-dev/browse_thread/thread/df977021a6357ff3/

Attachments (1)
Change History (7)

Changed February 03, 2009 03:39PM UTC by gglockner comment:1

Clarification: if the user clicks on the checkbox first, then jQuery is unable to change the state of the checkbox.

Changed February 04, 2009 12:02AM UTC by dmethvin comment:2

owner: → john

It sounds like this may be related to XML detection in Sizzle? See also #4054.

Changed February 04, 2009 10:50PM UTC by gglockner comment:3

Replying to [comment:2 dmethvin]:

It sounds like this may be related to XML detection in Sizzle? See also #4054.

I wondered about this. Should XHTML be treated as XML or as HTML?

Changed March 26, 2009 03:29PM UTC by andrew_ comment:4

This is directly related to http://dev.jquery.com/ticket/4283 (and is basically the same bug)

Changed March 26, 2009 03:52PM UTC by andrew_ comment:5

I've uploaded a temporary fix by proxying attr and remoteAttr. It's not an ideal solution or fix. But for folks with the server sending application-xhtml+xml content type correctly, this will work.

Changed May 10, 2009 01:29PM UTC by dmethvin comment:6

I think this is another property-vs-attribute issue. The browser determines the initial value of the checked property by looking at the checked attribute. The checked property controls whether the box is checked or not.

Changed October 03, 2010 02:07AM UTC by dmethvin comment:7

resolution: → duplicate
status: newclosed

Dup of #4283 which has more discussion.