aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.accordion.js
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2009-05-11 11:43:48 +0000
committerJörn Zaefferer <joern.zaefferer@gmail.com>2009-05-11 11:43:48 +0000
commit892824558c0004a519ea3772bdf7205bd50006f5 (patch)
tree2d768b0a2bbe6faa5aef8f5b8b01771ed035ac39 /ui/ui.accordion.js
parent2291be6a65f8b0a23ec1cf44546cda0bc7147423 (diff)
downloadjquery-ui-892824558c0004a519ea3772bdf7205bd50006f5.tar.gz
jquery-ui-892824558c0004a519ea3772bdf7205bd50006f5.zip
Fix for #4222
Diffstat (limited to 'ui/ui.accordion.js')
-rw-r--r--ui/ui.accordion.js33
1 files changed, 28 insertions, 5 deletions
diff --git a/ui/ui.accordion.js b/ui/ui.accordion.js
index baf6e9f9b..5fb6b501a 100644
--- a/ui/ui.accordion.js
+++ b/ui/ui.accordion.js
@@ -60,8 +60,7 @@ $.widget("ui.accordion", {
this.active.next().addClass('ui-accordion-content-active');
//Append icon elements
- $("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
- this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);
+ this._createIcons();
// IE7-/Win - Extra vertical space in lists fixed
if ($.browser.msie) {
@@ -104,6 +103,20 @@ $.widget("ui.accordion", {
}
},
+
+ _createIcons: function() {
+ var o = this.options;
+ if (o.icons) {
+ $("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
+ this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);
+ this.element.addClass("ui-accordion-icons");
+ }
+ },
+
+ _destroyIcons: function() {
+ this.headers.children(".ui-icon").remove();
+ this.element.removeClass("ui-accordion-icons");
+ },
destroy: function() {
var o = this.options;
@@ -120,7 +133,7 @@ $.widget("ui.accordion", {
.removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");
this.headers.find("a").removeAttr("tabindex");
- this.headers.children(".ui-icon").remove();
+ this._destroyIcons();
var contents = this.headers.next().css("display", "").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");
if (o.autoHeight || o.fillHeight) {
contents.css("height", "");
@@ -130,8 +143,18 @@ $.widget("ui.accordion", {
},
_setData: function(key, value) {
- if(key == 'alwaysOpen') { key = 'collapsible'; value = !value; }
- $.widget.prototype._setData.apply(this, arguments);
+ // alwaysOpen is deprecated
+ if(key == 'alwaysOpen'){ key = 'collapsible'; value = !value; }
+
+ $.widget.prototype._setData.apply(this, arguments);
+
+ if (key == "icons") {
+ this._destroyIcons();
+ if (value) {
+ this._createIcons();
+ }
+ }
+
},
_keydown: function(event) {