[Jifty-commit] r5324 - in jifty/trunk: share/web/static/js
Jifty commits
jifty-commit at lists.jifty.org
Thu Apr 17 10:57:43 EDT 2008
Author: hlb
Date: Thu Apr 17 10:57:37 2008
New Revision: 5324
Added:
jifty/trunk/share/web/static/js/jquery_patch.js
Modified:
jifty/trunk/lib/Jifty/Web.pm
Log:
add setTimout to globalEval in jQuery, so the SPA should work in IE now. IE sucks.
Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm (original)
+++ jifty/trunk/lib/Jifty/Web.pm Thu Apr 17 10:57:37 2008
@@ -39,6 +39,7 @@
jsan/DOM/Events.js
json.js
jquery-1.2.3.js
+ jquery_patch.js
iutil.js
iautocompleter.js
jifty_interface.js
Added: jifty/trunk/share/web/static/js/jquery_patch.js
==============================================================================
--- (empty file)
+++ jifty/trunk/share/web/static/js/jquery_patch.js Thu Apr 17 10:57:37 2008
@@ -0,0 +1,32 @@
+/**
+ * jquery_patch.js - patch jQuery in the right manner
+ */
+jQuery.extend({
+ globalEval: function( data ) {
+ data = jQuery.trim( data );
+
+ if ( data ) {
+ // Inspired by code by Andrea Giammarchi
+ // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
+ var head = document.getElementsByTagName("head")[0] || document.documentElement,
+ script = document.createElement("script");
+
+ script.type = "text/javascript";
+ if ( jQuery.browser.msie ) {
+ script.text = data;
+ }
+ else
+ script.appendChild( document.createTextNode( data ) );
+
+ head.appendChild( script );
+ try {
+ head.removeChild( script );
+ } catch( error ) {
+ setTimeout( function() {
+ var head = document.getElementsByTagName("head")[0] || document.documentElement;
+ head.removeChild( script );
+ }, 0);
+ }
+ }
+ }
+});
More information about the Jifty-commit
mailing list