fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2012-03-05 10:05 am

[dw-free] (jquery beta - cut tag) .cuttag-open applied to a different element than non-beta

[commit: http://hg.dwscoalition.org/dw-free/rev/cc649cfdfd5f]

http://bugs.dwscoalition.org/show_bug.cgi?id=4295

Apply the cuttag-open class to the div, not to the arrow, to make it
consistent with the non-jquery version. This also makes it easy for people
to style .cuttag-open, if desired.

Patch by [personal profile] fu.

Files modified:
  • htdocs/js/jquery.cuttag-ajax.js
--------------------------------------------------------------------------------
diff -r d13c71f8f75e -r cc649cfdfd5f htdocs/js/jquery.cuttag-ajax.js
--- a/htdocs/js/jquery.cuttag-ajax.js	Mon Mar 05 17:38:27 2012 +0800
+++ b/htdocs/js/jquery.cuttag-ajax.js	Mon Mar 05 18:06:05 2012 +0800
@@ -66,7 +66,7 @@
             this.open();
     },
     isOpen: function() {
-        return this.element.hasClass("cuttag-open") ? 1 : 0;
+        return this.tag.div.hasClass("cuttag-open") ? 1 : 0;
     },
     toggle: function() {
         if ( this.isOpen() )
@@ -95,7 +95,7 @@
     close: function() {
         if ( ! this.isOpen() )
             return;
-        this.element.removeClass("cuttag-open");
+        this.tag.div.removeClass("cuttag-open");
         this._setArrow("/collapse.gif", this.config.text.expand);
 
         this.tag.div.empty();
@@ -119,8 +119,8 @@
             self._setArrow("/collapse.gif", self.config.text.expand);
         } else {
             var replaceDiv = self.tag.div;
-            replaceDiv.html(resObj.text);
-            replaceDiv.css("display","block");
+            replaceDiv.html(resObj.text)
+                .css("display","block").addClass("cuttag-open");
 
             var closeEnd = $("<span>");
             var a = $("<a>",{
@@ -145,7 +145,6 @@
                 self.toggle();
             });
 
-            self.element.addClass("cuttag-open");
             self._setArrow("/expand.gif", self.config.text.collapse);
 
             replaceDiv.trigger( "updatedcontent.entry" );
--------------------------------------------------------------------------------