Closed RichardD2 closed 11 years ago
Which browser are you testing this in? In IE 6 everything seems to work fine.
It's broken in Firefox 18.0.1, Opera 12.13 and IE9. IE8 compatibility mode is even worse - you can't expand a collapsed element. IE7 compatibility mode works fine. Chrome supports the element natively, so it works as expected.
Should be fixed now. Thanks for reporting the issue and even providing a fix!
Your demo page is pulling in jQuery 1.9 from the Google CDN. As a result, once you've clicked on an element, you can no longer change its state. Elements which start closed can be opened once and never closed again; elements which start open can be closed once and never opened again.
This seems to be related to the changes around attr/prop handling: http://jquery.com/upgrade-guide/1.9/#attr-versus-prop-
The following two changes seem to fix the problem:
Line 35: (toggleOpen) Replace:
var isOpen = typeof $details.attr('open') == 'string',
With:var isOpen = $details.prop('open'),
Line 125: Add:
$details.prop('open', typeof $details.attr('open') == 'string');
Before:toggleOpen($details, $detailsSummary, $detailsNotSummary);