Bug Tracker

Opened 11 years ago

Closed 9 years ago

#4049 closed bug (duplicate)

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)

4283 Temporary Fix.txt (815 bytes) - added by andrew_ 11 years ago.
Temporary Fix - Not a Patch

Download all attachments as: .zip

Change History (8)

comment:1 Changed 11 years ago by gglockner

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

comment:2 Changed 11 years ago by dmethvin

Owner: set to john

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

comment:3 in reply to:  2 Changed 11 years ago by gglockner

Replying to 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?

comment:4 Changed 11 years ago by andrew_

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

Changed 11 years ago by andrew_

Attachment: 4283 Temporary Fix.txt added

Temporary Fix - Not a Patch

comment:5 Changed 11 years ago by andrew_

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.

comment:6 Changed 10 years ago by dmethvin

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.

comment:7 Changed 9 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Dup of #4283 which has more discussion.

Note: See TracTickets for help on using tickets.