[Jifty-commit] r519 - in jifty/trunk: lib/Jifty share/web/static/js

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Jan 21 00:52:32 EST 2006


Author: alexmv
Date: Sat Jan 21 00:52:30 2006
New Revision: 519

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web.pm
   jifty/trunk/share/web/static/js/jifty.js
   jifty/trunk/share/web/static/js/prototype.js

Log:
 r8732 at zoq-fot-pik:  chmrr | 2006-01-21 00:25:15 -0500
  * Jump through some hoops for safari
  * Better escape mechanism after redirect


Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm	(original)
+++ jifty/trunk/lib/Jifty/Web.pm	Sat Jan 21 00:52:30 2006
@@ -224,8 +224,6 @@
     } else {
         $self->_internal_request( Jifty::Request->new->fill(@_) );
     }
-
-  REQUEST_ABORT:
 }
 
 # Called when continuations get run, as well as by handle_request;
@@ -618,7 +616,7 @@
         $apache->header_out( Location => $page );
         $apache->header_out( Status => 302 );
         $apache->send_http_header();
-        goto REQUEST_ABORT;
+        Jifty::Dispatcher::last_rule();
     }
 
 }

Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js	(original)
+++ jifty/trunk/share/web/static/js/jifty.js	Sat Jan 21 00:52:30 2006
@@ -314,7 +314,7 @@
         return {
             name: this.name,
             path: this.setPath(path),
-            args: this.setArgs(args),
+            args: this.setArgs(args)
         }
     }
 };
@@ -407,14 +407,20 @@
                          response_fragment != null;
                          response_fragment = response_fragment.nextSibling) {
                         if (response_fragment.getAttribute("id") == f['region']) {
+                            var textContent;
+                            if (response_fragment.textContent) {
+                                textContent = response_fragment.textContent;
+                            } else {
+                                textContent = response_fragment.firstChild.nodeValue;
+                            }
                             // Once we find it, do the insertion
                             if (insertion) {
-                                new insertion(element, response_fragment.textContent.stripScripts());
+                                new insertion(element, textContent.stripScripts());
                             } else {
-                                Element.update(element, response_fragment.textContent.stripScripts());
+                                Element.update(element, textContent.stripScripts());
                             }
                             // We need to give the browser some "settle" time before we eval scripts in the body
-                            setTimeout((function() { this.evalScripts() }).bind(response_fragment.textContent), 10);
+                            setTimeout((function() { this.evalScripts() }).bind(textContent), 10);
                         }
                     }
 
@@ -466,7 +472,7 @@
     // Set up our options
     var options = { postBody: JSON.stringify(request),
                     onComplete: onComplete,
-                    requestHeaders: ['Content-Type', 'text/x-json'],
+                    requestHeaders: ['Content-Type', 'text/x-json']
     };
 
     // Go!
@@ -532,3 +538,19 @@
 
 });
 
+
+// Define hasOwnProperty for Safari
+if( !Object.prototype.hasOwnProperty ) {
+    Object.prototype.hasOwnProperty = function( property ) {
+        try {
+            var prototype = this.constructor.prototype;
+            while( prototype ) {
+                if( prototype[ property ] == this[ property ] ) {
+                    return false;
+                }
+                prototype = prototype.prototype;
+            }
+        } catch( e ) {}
+        return true;
+    }
+}

Modified: jifty/trunk/share/web/static/js/prototype.js
==============================================================================
--- jifty/trunk/share/web/static/js/prototype.js	(original)
+++ jifty/trunk/share/web/static/js/prototype.js	Sat Jan 21 00:52:30 2006
@@ -665,8 +665,12 @@
        'X-Prototype-Version', Prototype.Version];
 
     if (this.options.method == 'post') {
-      requestHeaders.push('Content-type',
-        'application/x-www-form-urlencoded');
+      var hasContentType = 0;
+      for (var i = 0; i < this.options.requestHeaders.length; i += 2) 
+        if (this.options.requestHeaders[i] == 'Content-Type')
+          hasContentType = 1;
+      if (hasContentType == 0)
+          requestHeaders.push('Content-Type', 'application/x-www-form-urlencoded');
 
       /* Force "Connection: close" for Mozilla browsers to work around
        * a bug where XMLHttpReqeuest sends an incorrect Content-length
@@ -1782,4 +1786,4 @@
 
     return [valueL, valueT];
   }
-}
\ No newline at end of file
+}


More information about the Jifty-commit mailing list