tha*_*way 17 javascript jquery html5 dom web-worker
所以我正在创建一个Web worker:
var arrayit = function(obj) {
return Array.prototype.slice.call(obj);
};
work = arrayit(images);
console.log(work);
//work = images.push.apply( images, array );
// Method : "load+scroll"
var worker = new Worker('jail_worker.js');
worker.postMessage(work)
worker.onmessage = function(event) {
console.log("Worker said:" + event.data);
};
Run Code Online (Sandbox Code Playgroud)
这是图像是什么:
$.jail.initialStack = this;
// Store the selector into 'triggerEl' data for the images selected
this.data('triggerEl', (options.selector) ? $(options.selector) : $window);
var images = this;
Run Code Online (Sandbox Code Playgroud)
我认为我的问题与此有关:
http://dev.w3.org/html5/spec/Overview.html#safe-passing-of-structured-data
我怎么能绕过这个?正如你所看到的,我尝试将主机对象切成真正的数组,但这不起作用.
这是我正在攻击的文件的链接:
https://github.com/jtmkrueger/JAIL
UPDATE ------------------------------------------------- -
这是我根据@davin接受的答案所做的事情:
var arrayit = function(obj) {
return Array.prototype.slice.call(obj);
};
imgArray = arrayit(images);
work = _.map(images, function(i){ return i.attributes[0].ownerElement.outerHTML; });
var worker = new Worker('jail_worker.js');
worker.postMessage(work)
worker.onmessage = function(event) {
console.log("Worker said:" + event.data);
};
Run Code Online (Sandbox Code Playgroud)
注意:我使用underscore.js来确保兼容性.
| 归档时间: |
|
| 查看次数: |
15715 次 |
| 最近记录: |