1.FileReader对象只支持DOM level 1 的某些事件。例如如下onprogress 事件,.bind(), .on()的handler的被传入事件均没有某些属性(dataTransfer, lengthComputable, etc.)的值;(jquery-1.9.1.js)
var reader = new FileReader;
function ccc (evt){
console.log((evt.lengthComputable, evt.loaded, evt.total);
}
}
r.onprogress = ccc; //正常输出lengthComputable, loaded, total的值;
//$(r).on("progress", ccc); //this evt's lengthComputable,total,loaded are undefined! same effect on .bind();2. jquery treat $(input).attr('checked') and $(input)[0].checked differently; pay attend to the several built-in property of DOM element. e.g. id, class, checked, etc.
3. ajax callback will failed silently without the error tip output by the console, if the sent back data is not formal json, e.g. { result: "ok" }, it must be formal json: { "result": "ok" }
本文深入探讨了JS FileReader对象在DOMlevel1中支持的事件及使用注意事项,同时揭示了jQuery在处理input元素的checked属性时的细微差异,并强调了AJAX回调在返回非正式JSON数据时的潜在问题。通过实例分析,提供了解决这些问题的有效策略。
2041

被折叠的 条评论
为什么被折叠?



