jquery.fileupload-image-editor.js
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)
click .foo". The _on() method provides several benefits of direct event binding:
- Maintains proper
thiscontext inside the handlers. - Automatically handles disabled widgets: If the widget is disabled or the event occurs on an element with the
ui-state-disabledclass, the event handler is not invoked. Can be overridden with thesuppressDisabledCheckparameter. - Event handlers are automatically namespaced and cleaned up on destroy.
- suppressDisabledCheck (default:
false)Type: BooleanWhether or not to bypass the disabled check. - elementType: jQueryWhich element(s) to bind the event handlers to. If no element is provided,
this.elementis used for non-delegated events and the widget element is used for delegated events. - handlersType: ObjectAn 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.
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的更多相关文章
- jQuery FileUpload等插件的使用实例
1.jQuery FileUpload 需要的js: jquery.js jquery.fileupload.js jquery.iframe-transport.js jquery.xdr-tran ...
- 另一种图片上传 jquery.fileupload.js
今天遇到另外一种上传图片方法 用jquery.fileupload.js <input type="file" name="file[]" multipl ...
- jquery.fileupload插件的简易使用日志
来源:http://yixiandave.iteye.com/blog/1897330 本文内容主要包含fileupload插件传递参数和取回服务器返回数据的方法 jquery.fileupload官 ...
- MVC文件上传-使用jQuery.FileUpload和Backload组件实现文件上传
本篇使用客户端jQuery-File-Upload插件和服务端Badkload组件实现多文件异步上传.MVC文件上传相关兄弟篇: 处理文件上传的服务端组件Backload 用于处理文件上传的服务端组件 ...
- 使用jQuery.FileUpload插件和服Backload组件自定义上传文件夹
在零配置情况下,文件的上传文件夹是根目录下的Files文件夹,如何自定义文件的上传文件夹呢? □ 在web.config中配置 1: <configuration> 2: <conf ...
- 使用jQuery.FileUpload和Backload自定义控制器上传多个文件
当需要在控制器中处理除了文件的其他表单字段,执行控制器独有的业务逻辑......等等,这时候我们可以自定义控制器. 通过继承BackloadController □ 思路 BackloadContro ...
- 使用jQuery.FileUpload插件和Backload组件裁剪上传图片
□ 思路 1.自定义控制器继承Backload的默认控制器BackloadController2.自定义一个jQuery File Upload初始化js文件,使用自定义控制器的方法3.在视图页面调用 ...
- 关于jquery.fileupload结合PHP上传图片的开发用法流程
这阵子做了一个项目,涉及到了图片上传,以往用的都是uploadify这个插件,感觉它在PC上的使用还是很强大的, 不过最近这个项目涉及到了移动端的上传,其实uploadify也可以,但是他有一个 up ...
- 解决ewebeditor for php在IE8下报editor.js错误的解决方案
打开editor.js,寻找如下代码: if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()"); ...
- javascript: jquery.gomap-1.3.3.js
from:http://www.pittss.lv/jquery/gomap/solutions.php jquery.gomap-1.3.3.js: /** * jQuery goMap * * @ ...
随机推荐
- linux:RAID(磁盘阵列)笔记
RAID磁盘阵列简述: RAID0(条带): 把多个同样大小的磁盘串联起来当做一个磁盘来用. 优点:读写速度快. 缺点:数据容易丢失(没有容错能力). ...
- [.net core]10.请求静态文件, 自定义默认文件名
何谓静态文件,文件系统上的文件, css, javascript , image. html 这些都属于静态文件, .net core web app 默认是不处理文件请求的. 我们来做一个实验 ...
- MySql 5.7关键字和保留字-附表
现在使用navicat图形界面或者Hibernate做映射生成表的时候,渐渐的会忽视掉关键字这个问题,而后续也会不断的产生错误提示,一遍遍的查询代码无果,甚至开始怀疑人生,但是其实很多情况下只是使用了 ...
- Action实现prepareable接口后定义前置方法
// 访问每一个action的方法都会先调用此方法:前置方法 @Override public void prepare() throws Exception { System.out.println ...
- DEV第三方控件的GalleryControl控件
1.获取选中的图片 List<GalleryItem> lstArray = gclImage.Gallery.GetCheckedItems(); 2.滚动到GalleryControl ...
- 配置 http 反向代理
[root@nginx ~]# cd /etc/nginx/ 1 [root@nginx nginx]# cp nginx.conf nginx.conf.bak #备份一个原配置文件 2 [root ...
- python接口测试中—Requests模块的使用
Requests模块的使用 中文文档API:http://2.python-requests.org/en/master/ 1.发送get.post请求 import requests reponse ...
- Kendo UI使用教程:入门指南
[Kendo UI最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support for React和 ...
- 基于element ui 实现七牛云自定义key上传文件,并监听更新上传进度
借助上传Upload 上传组件的 http-request 覆盖默认的上传行为,可以自定义上传的实现 <el-upload multiple ref="sliderUpload&quo ...
- Django报错 No module named 'django.templates'
前言 Django 模板报错了 修改方法: 将你的工程文件下(my_site)的settings.py中的TEMPLATES中的templates字段全部改为template, 亲测可用~^~