Skip to content

Instantly share code, notes, and snippets.

@sophiebits
Created August 28, 2008 23:49
Show Gist options
  • Save sophiebits/7861 to your computer and use it in GitHub Desktop.
Save sophiebits/7861 to your computer and use it in GitHub Desktop.
allow better YUI compression
--- a/jquery-1.2.6.js
+++ b/jquery-1.2.6.js
@@ -27,8 +27,9 @@
@@ -10,6 +10,9 @@
* $Rev: 5685 $
*/
+// Allow munging window's name.
+var window = this;
+
// Map over jQuery in case of overwrite
var _jQuery = window.jQuery,
// Map over the $ in case of overwrite
@@ -1765,7 +1768,7 @@
fn = fn[ m[2] ];
if ( typeof fn == "string" )
- fn = eval("false||function(a,i){return " + fn + ";}");
+ fn = window['eval']("false||function(a,i){return " + fn + ";}");
// Execute it against the current filter
r = jQuery.grep( r, function(elem, i){
@@ -2893,7 +2896,7 @@
// Get the JavaScript object, if JSON is used.
if ( type == "json" )
- data = eval("(" + data + ")");
+ data = window['eval']("(" + data + ")");
return data;
},
@@ -3359,13 +3362,16 @@
// Originally By Brandon Aaron, part of the Dimension Plugin
// http://jquery.com/plugins/project/dimensions
jQuery.fn.offset = function() {
- var left = 0, top = 0, elem = this[0], results;
+ var left = 0, top = 0, elem = this[0], results, browser = jQuery.browser;
- if ( elem ) with ( jQuery.browser ) {
+ if ( elem ) {
var parent = elem.parentNode,
offsetChild = elem,
offsetParent = elem.offsetParent,
doc = elem.ownerDocument,
+ version = browser.version,
+ mozilla = browser.mozilla,
+ safari = browser.safari,
safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent),
css = jQuery.curCSS,
fixed = css(elem, "position") == "fixed";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment