jquery.fileupload-image-editor.js中

  _initEventHandlers: function () {
this._super(); var handlers = {};
handlers[this.options.uploadImageEditorPreviewSelector] = this._previewHandler.bind(this); this._on(this.options.filesContainer, handlers);
},

jquery.ui.widget.js

    _on: function( suppressDisabledCheck, element, handlers ) {
var delegateElement,
instance = this; // no suppressDisabledCheck flag, shuffle arguments
if ( typeof suppressDisabledCheck !== "boolean" ) {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
} // no element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
element = delegateElement = $( element );
this.bindings = this.bindings.add( element );
}

遇到错误

是因为找不到

uploadTemplateId: 'template-upload',

Uncaught TypeError: Cannot read property 'innerHTML' of null
at Function.tmpl.load (tmpl.js:38)

tmpl.load = function (id) {
return document.getElementById(id).innerHTML
}

at tmpl (tmpl.js:21)

var tmpl = function (str, data) {
var f = !/[^\w\-.:]/.test(str)
? (tmpl.cache[str] = tmpl.cache[str] || tmpl(tmpl.load(str)))
: new Function( // eslint-disable-line no-new-func
tmpl.arg + ',tmpl',
'var _e=tmpl.encode' +
tmpl.helper +
",_s='" +
str.replace(tmpl.regexp, tmpl.func) +
"';return _s;"
)
return data
? f(data, tmpl)
: function (data) {
return f(data, tmpl)
}
}

at $.<computed>.<computed>._initTemplates (jquery.fileupload-ui.js:657)

_initTemplates: function () {
var options = this.options;
options.templatesContainer = this.document[0].createElement(
options.filesContainer.prop('nodeName')
);
if (tmpl) {
if (options.uploadTemplateId) {
options.uploadTemplate = tmpl(options.uploadTemplateId);
}
if (options.downloadTemplateId) {
options.downloadTemplate = tmpl(options.downloadTemplateId);
}
}
}

at $.<computed>.<computed>._initTemplates (jquery.ui.widget.js:127)
at $.<computed>.<computed>._initSpecialOptions (jquery.fileupload-ui.js:677)

_initSpecialOptions: function () {
this._super();
this._initFilesContainer();
this._initTemplates();
},

at $.<computed>.<computed>._initSpecialOptions (jquery.ui.widget.js:127)
at $.<computed>.<computed>._create (jquery.fileupload.js:1381)

_create: function () {
this._initDataAttributes();
this._initSpecialOptions();
this._slots = [];
this._sequence = this._getXHRPromise(true);
this._sending = this._active = 0;
this._initProgressObject(this);
this._initEventHandlers();
},

at $.<computed>.<computed>._create (jquery.ui.widget.js:127)
at $.<computed>.<computed>._super (jquery.ui.widget.js:114)
at $.<computed>.<computed>._create (jquery.fileupload-process.js:167)

_create: function () {
this._super();
this._processing = 0;
this._processingQueue = $.Deferred().resolveWith(this)
.promise();
}

扩展阅读

https://api.jqueryui.com/jQuery.widget/#method-_on

_on( [suppressDisabledCheck ] [, element ], handlers )Returns: jQuery (plugin only)

Binds event handlers to the specified element(s). Delegation is supported via selectors inside the event names, e.g., "click .foo". The _on() method provides several benefits of direct event binding:

  • Maintains proper this context inside the handlers.
  • Automatically handles disabled widgets: If the widget is disabled or the event occurs on an element with the ui-state-disabled class, the event handler is not invoked. Can be overridden with the suppressDisabledCheck parameter.
  • Event handlers are automatically namespaced and cleaned up on destroy.
  • suppressDisabledCheck (default: false)
    Type: Boolean
    Whether or not to bypass the disabled check.
  • element
    Type: jQuery
    Which element(s) to bind the event handlers to. If no element is provided, this.element is used for non-delegated events and the widget element is used for delegated events.
  • handlers
    Type: Object
    An object in which the keys represent the event type and optional selector for delegation, and the values represent a handler function to be called for the event.
Code examples:

Prevent the default action of all links clicked within the widget's element.

this._on( this.element, {
"click a": function( event ) {
event.preventDefault();
}
});

https://www.runoob.com/jquery/traversing-closest.html

定义和用法

closest() 方法返回被选元素的第一个祖先元素。

祖先是父、祖父、曾祖父,依此类推。

DOM 树:该方法从当前元素向上遍历,直至文档根元素的所有路径(<html>),来查找 DOM 元素的第一个祖先元素。

该方法与 parents() 类似,都是向上遍历 DOM 树,不同点是:

closest()

  • 从当前元素开始
  • 沿 DOM 树向上遍历,并返回匹配所传递的表达式的第一个单一祖先
  • 返回包含零个或一个元素的 jQuery 对象

parents()

  • 从父元素开始
  • 沿 DOM 树向上遍历,并返回匹配所传递的表达式的所有祖先
  • 返回包含零个、一个或多个元素的 jQuery 对象

jquery.fileupload-image-editor.js的更多相关文章

  1. jQuery FileUpload等插件的使用实例

    1.jQuery FileUpload 需要的js: jquery.js jquery.fileupload.js jquery.iframe-transport.js jquery.xdr-tran ...

  2. 另一种图片上传 jquery.fileupload.js

    今天遇到另外一种上传图片方法 用jquery.fileupload.js <input type="file" name="file[]" multipl ...

  3. jquery.fileupload插件的简易使用日志

    来源:http://yixiandave.iteye.com/blog/1897330 本文内容主要包含fileupload插件传递参数和取回服务器返回数据的方法 jquery.fileupload官 ...

  4. MVC文件上传-使用jQuery.FileUpload和Backload组件实现文件上传

    本篇使用客户端jQuery-File-Upload插件和服务端Badkload组件实现多文件异步上传.MVC文件上传相关兄弟篇: 处理文件上传的服务端组件Backload 用于处理文件上传的服务端组件 ...

  5. 使用jQuery.FileUpload插件和服Backload组件自定义上传文件夹

    在零配置情况下,文件的上传文件夹是根目录下的Files文件夹,如何自定义文件的上传文件夹呢? □ 在web.config中配置 1: <configuration> 2: <conf ...

  6. 使用jQuery.FileUpload和Backload自定义控制器上传多个文件

    当需要在控制器中处理除了文件的其他表单字段,执行控制器独有的业务逻辑......等等,这时候我们可以自定义控制器. 通过继承BackloadController □ 思路 BackloadContro ...

  7. 使用jQuery.FileUpload插件和Backload组件裁剪上传图片

    □ 思路 1.自定义控制器继承Backload的默认控制器BackloadController2.自定义一个jQuery File Upload初始化js文件,使用自定义控制器的方法3.在视图页面调用 ...

  8. 关于jquery.fileupload结合PHP上传图片的开发用法流程

    这阵子做了一个项目,涉及到了图片上传,以往用的都是uploadify这个插件,感觉它在PC上的使用还是很强大的, 不过最近这个项目涉及到了移动端的上传,其实uploadify也可以,但是他有一个 up ...

  9. 解决ewebeditor for php在IE8下报editor.js错误的解决方案

    打开editor.js,寻找如下代码: if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()"); ...

  10. javascript: jquery.gomap-1.3.3.js

    from:http://www.pittss.lv/jquery/gomap/solutions.php jquery.gomap-1.3.3.js: /** * jQuery goMap * * @ ...

随机推荐

  1. 一遍记住 8 种排序算法与 Java 代码实现

    ☞ 程序员进阶必备资源免费送「21种技术方向!」 ☜ 作者:KaelQ, www.jianshu.com/p/5e171281a387 1.直接插入排序 经常碰到这样一类排序问题:把新的数据插入到已经 ...

  2. KNN-综合应用

    本文代码均来自<机器学习实战> 这里讲了两个例子,datingclass 和 figureclass,用到的都是KNN,要调用这两个例子的话就在代码末尾加datingClassTest() ...

  3. python中逐行打印

    方法一:readline函数 f = open("./code.txt") # 返回一个文件对象 line = f.readline() # 调用文件的 readline()方法 ...

  4. C语言面试相关知识点

    1.关键字static的作用是什么? 有三个明显的作用: 1)在函数体内,一个被声明为静态的变量在这个函数被调用过程中维持其值不变 2)在模块内(但在函数体外),静态的变量可以被模块内所有函数访问,但 ...

  5. VMware三种连接方式bridge, nat, host-only

    大家在安装完虚拟机后,默认安装了两个虚拟网卡,VMnet1和 VMnet8,其他的未安装(当然也可以手动安装其他的).其中VMnet1是host网卡,用于host方式连接网络的.VMnet8是NAT网 ...

  6. Laravel5学习

    [1]缓存问题 laravel中使用的配置文件,都会放在config目录下面,当变更某个参数的时候,如果发现不生效,可以在命令行下面执行  php artisan config:clear 命令才清除 ...

  7. java数据结构复习02

    1.递归问题 1.1汉诺塔问题(递归) 问题描述三个柱子,起初有若干个按大小关系顺序安放的盘子,需要全部移动到另外一个柱子上.移动规则:在小圆盘上不能放大圆盘,在三根柱子之间一次只能移动一个圆盘.移动 ...

  8. 使用python开发WebService

    使用python开发WebService 分类: web linux2009-03-30 11:36 6621人阅读 评论(1) 收藏 举报 webservicepythonsoapimportecl ...

  9. 【NOIP2016提高A组集训第4场11.1】平衡的子集

    题目 夏令营有N个人,每个人的力气为M(i).请大家从这N个人中选出若干人,如果这些人可以分成两组且两组力气之和完全相等,则称为一个合法的选法,问有多少种合法的选法? 分析 如果暴力枚举每个人被分到哪 ...

  10. 【NOIP2016提高A组模拟8.17】(雅礼联考day1)总结

    考的还ok,暴力分很多,但有点意外的错误. 第一题找规律的题目,推了好久.100分 第二题dp,没想到. 第三题树状数组.比赛上打了个分段,准备拿60分,因为时间不够,没有对拍,其中有分段的20分莫名 ...