Skip to content

Commit 1c6eccd

Browse files
committed
强化跨域处理
1 parent 4c1bab4 commit 1c6eccd

File tree

6 files changed

+605
-598
lines changed

6 files changed

+605
-598
lines changed

event.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//=========================================
22
// 事件系统 v9
33
//==========================================
4-
define("event", self.dispatchEvent ? ["node"] : ["event_fix"], function($) {
4+
define("event", window.dispatchEvent ? ["node"] : ["event_fix"], function($) {
55
var facade = $.event || ($.event = {
66
//对某种事件类型进行特殊处理
77
special: {},

index.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
var messager = new Messenger({
1111
target: '#iframe',
1212
onmessage: function(data) {
13-
$.log(data)
13+
console.log(data)
1414
}
1515
});
16+
// alert(iframe[0].contentWindow.eval)
1617
iframe.on("load", function() {
18+
// $.log("============")
1719
messager.send('发给子页面的消息');
1820
});
1921

mass.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"NaN": "NaN",
2626
"undefined": "Undefined"
2727
};
28-
var toString = class2type.toString,
28+
var serialize = class2type.toString,
2929
basepath;
3030
/**
3131
* 命名空间
@@ -36,7 +36,7 @@
3636
*/
3737

3838
function $(expr, context) { //新版本的基石
39-
if ($.type(expr, "Function")) { //注意在safari下,typeof nodeList的类型为function,因此必须使用$.type
39+
if (typeof expr === "function" && expr.call) { //注意在safari下,typeof nodeList的类型为function,因此必须使用$.type
4040
return $.require(all + ",ready", expr);
4141
}
4242
if (!$.fn)
@@ -186,7 +186,7 @@
186186
* @api public
187187
*/
188188
type: function(obj, str) {
189-
var result = class2type[(obj == null || obj !== obj) ? obj : toString.call(obj)] || obj.nodeName || "#";
189+
var result = class2type[(obj == null || obj !== obj) ? obj : serialize.call(obj)] || obj.nodeName || "#";
190190
if (result.charAt(0) === "#") { //兼容旧式浏览器与处理个别情况,如window.opera
191191
//利用IE678 window == document为true,document == window竟然为false的神奇特性
192192
if (obj == obj.document && obj.document != obj) {
@@ -198,7 +198,7 @@
198198
} else if (isFinite(obj.length) && obj.item) {
199199
result = "NodeList"; //处理节点集合
200200
} else {
201-
result = toString.call(obj).slice(8, -1);
201+
result = serialize.call(obj).slice(8, -1);
202202
}
203203
}
204204
if (str) {

0 commit comments

Comments
 (0)