Skip to content

Commit

Permalink
Support jQuery 1.9
Browse files Browse the repository at this point in the history
Thanks to @RichardD2 in #11.
  • Loading branch information
mathiasbynens committed Feb 1, 2013
1 parent 43d39ea commit 3cc7fc6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ This plugin includes my [noSelect jQuery plugin](http://mths.be/noselect).

This plugin automatically feature tests for native `<details>`/`<summary>` support and only enables the fallback when it’s necessary. You don’t have to write any feature tests yourself.

This plugin requires jQuery 1.7+. For a version that works with older jQueries, [see v0.0.1](https://github.com/mathiasbynens/jquery-details/blob/0.0.1/jquery.details.js).
This plugin requires jQuery 1.9+. For a version that works with jQuery 1.8 or older, [see v0.0.6](https://github.com/mathiasbynens/jquery-details/blob/0.0.6/jquery.details.js). For a version that works with jQuery 1.6 or older, [see v0.0.1](https://github.com/mathiasbynens/jquery-details/blob/0.0.1/jquery.details.js).

This fallback works in all A-grade browsers, including IE6. It will only be executed if the `<details>` element is not natively supported in the browser. If it isn’t, and JavaScript is disabled, all elements will still be visible to the user.

Expand Down
26 changes: 13 additions & 13 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ <h1>Copying “Really Achieving Your Childhood Dreams” (<code>details</code> w
<details>
<dl>
<dt>Transfer rate:</dt>
<dd>452KB/s</dd>
<dd>452KB/s</dd>
<dt>Local filename:</dt>
<dd>/home/rpausch/raycd.m4v</dd>
<dd>/home/rpausch/raycd.m4v</dd>
<dt>Remote filename:</dt>
<dd>/var/www/lectures/raycd.m4v</dd>
<dd>/var/www/lectures/raycd.m4v</dd>
<dt>Duration:</dt>
<dd>01:16:27</dd>
<dd>01:16:27</dd>
<dt>Color profile:</dt>
<dd>SD (6-1-6)</dd>
<dd>SD (6-1-6)</dd>
<dt>Dimensions:</dt>
<dd>320×240</dd>
<dd>320×240</dd>
</dl>
</details>
</section>
Expand All @@ -85,17 +85,17 @@ <h1>Copying “Really Achieving Your Childhood Dreams” (<code>details</code> w
<summary>Copying… <progress max="375505392" value="97543282"></progress> 25%</summary>
<dl>
<dt>Transfer rate:</dt>
<dd>452KB/s</dd>
<dd>452KB/s</dd>
<dt>Local filename:</dt>
<dd>/home/rpausch/raycd.m4v</dd>
<dd>/home/rpausch/raycd.m4v</dd>
<dt>Remote filename:</dt>
<dd>/var/www/lectures/raycd.m4v</dd>
<dd>/var/www/lectures/raycd.m4v</dd>
<dt>Duration:</dt>
<dd>01:16:27</dd>
<dd>01:16:27</dd>
<dt>Color profile:</dt>
<dd>SD (6-1-6)</dd>
<dd>SD (6-1-6)</dd>
<dt>Dimensions:</dt>
<dd>320×240</dd>
<dd>320×240</dd>
</dl>
</details>
</section>
Expand Down Expand Up @@ -143,7 +143,7 @@ <h1>Nested <code>details</code> elements</h1>
<p>lolwat</p>
</details>
</section>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="jquery.details.js"></script>
<script>
window.console || (window.console = { 'log': alert });
Expand Down
5 changes: 3 additions & 2 deletions jquery.details.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! http://mths.be/details v0.0.6 by @mathias | includes http://mths.be/noselect v1.0.3 */
/*! http://mths.be/details v0.1.0 by @mathias | includes http://mths.be/noselect v1.0.3 */
;(function(document, $) {

var proto = $.fn,
Expand Down Expand Up @@ -32,7 +32,7 @@
return diff;
}(document)),
toggleOpen = function($details, $detailsSummary, $detailsNotSummary, toggle) {
var isOpen = typeof $details.attr('open') == 'string',
var isOpen = $details.prop('open'),
close = isOpen && toggle || !isOpen && !toggle;
if (close) {
$details.removeClass('open').prop('open', false).triggerHandler('close.details');
Expand Down Expand Up @@ -122,6 +122,7 @@
}

// Hide content unless there’s an `open` attribute
$details.prop('open', typeof $details.attr('open') == 'string');
toggleOpen($details, $detailsSummary, $detailsNotSummary);

// Add `role=button` and set the `tabindex` of the `summary` element to `0` to make it keyboard accessible
Expand Down
4 changes: 2 additions & 2 deletions jquery.details.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3cc7fc6

Please sign in to comment.