Skip to content
Browse files

去掉对top窗口的访问,防止跨域时报错

  • Loading branch information...
1 parent a13da7c commit 4c1bab41462f77570d6242707fb2e84ad82aa56a @RubyLouvre committed Mar 13, 2013
Showing with 5,656 additions and 5,657 deletions.
  1. +1 −1 attr.js
  2. +1 −1 css.js
  3. +1 −1 css_fix.js
  4. +1 −1 event.js
  5. +5,642 −5,643 mass_merge.js
  6. +5 −5 more/brower.js
  7. +4 −4 more/detectZoom.js
  8. +1 −1 node.js
View
2 attr.js
@@ -1,7 +1,7 @@
//==================================================
// 属性操作模块 v3
//==================================================
-define("attr", !! top.getComputedStyle ? ["node"] : ["attr_fix"], function($) {
+define("attr", !! this.getComputedStyle ? ["node"] : ["attr_fix"], function($) {
var rreturn = /\r/g,
rtabindex = /^(a|area|button|input|object|select|textarea)$/i,
rnospaces = /\S+/g,
View
2 css.js
@@ -1,7 +1,7 @@
//=========================================
// 样式操作模块 v5 by 司徒正美
//=========================================
-define("css", top.getComputedStyle ? ["node"] : ["css_fix"], function($) {
+define("css", this.getComputedStyle ? ["node"] : ["css_fix"], function($) {
var adapter = $.cssHooks || ($.cssHooks = {}),
rrelNum = /^([\-+])=([\-+.\de]+)/,
rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
View
2 css_fix.js
@@ -3,7 +3,7 @@
//==========================================
define("css_fix", !! document.dispatchEvent, ["node"], function($) {
var adapter = $.cssHooks = {},
- ie8 = !! top.XDomainRequest,
+ ie8 = !! window.XDomainRequest,
rfilters = /[\w\:\.]+\([^)]+\)/g,
rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
rposition = /^(top|right|bottom|left)$/,
View
2 event.js
@@ -1,7 +1,7 @@
//=========================================
// 事件系统 v9
//==========================================
-define("event", top.dispatchEvent ? ["node"] : ["event_fix"], function($) {
+define("event", self.dispatchEvent ? ["node"] : ["event_fix"], function($) {
var facade = $.event || ($.event = {
//对某种事件类型进行特殊处理
special: {},
View
11,285 mass_merge.js
5,642 additions, 5,643 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
10 more/brower.js
@@ -1,18 +1,18 @@
define("brower", function( ){
//$.log("已加载brower模块");
- var ver = top.opera ? (opera.version().replace(/\d$/, "") - 0)
+ var w = window,ver = w.opera ? (opera.version().replace(/\d$/, "") - 0)
: parseFloat((/(?:IE |fox\/|ome\/|ion\/)(\d+\.\d)/.
exec(navigator.userAgent) || [,0])[1]);
return {
//测试是否为ie或内核为trident,是则取得其版本号
- ie: !!top.VBArray && Math.max(document.documentMode||0, ver),//内核trident
+ ie: !!w.VBArray && Math.max(document.documentMode||0, ver),//内核trident
//测试是否为firefox,是则取得其版本号
- firefox: !!top.netscape && ver,//内核Gecko
+ firefox: !!w.netscape && ver,//内核Gecko
//测试是否为opera,是则取得其版本号
- opera: !!top.opera && ver,//内核 Presto 9.5为Kestrel 10为Carakan
+ opera: !!w.opera && ver,//内核 Presto 9.5为Kestrel 10为Carakan
//测试是否为chrome,是则取得其版本号
- chrome: !! top.chrome && ver ,//内核V8
+ chrome: !! w.chrome && ver ,//内核V8
//测试是否为safari,是则取得其版本号
safari: /apple/i.test(navigator.vendor) && ver// 内核 WebCore
}
View
8 more/detectZoom.js
@@ -42,16 +42,16 @@ define("deltectZoom", function() {
}
};
function deleteBrower() {
- if (top.VBArray) {
+ if (self.VBArray) {
return "ie";
}
- if (top.netscape) {
+ if (self.netscape) {
return "firefox";
}
- if (top.opera) {
+ if (self.opera) {
return "opera";
}
- if (top.chrome) {
+ if (self.chrome) {
return "chrome";
}
}
View
2 node.js
@@ -1,7 +1,7 @@
//==================================================
// 节点操作模块
//==================================================
-define("node", ["support", "class", "query", "data"].concat(top.dispatchEvent ? [] : ["node_fix"]), function($) {
+define("node", ["support", "class", "query", "data"].concat(this.dispatchEvent ? [] : ["node_fix"]), function($) {
var rtag = /^[a-zA-Z]+$/,
rtagName = /<([\w:]+)/,
//取得其tagName

0 comments on commit 4c1bab4

Please sign in to comment.
Something went wrong with that request. Please try again.