Bun*_*ori 6 javascript web-services web-applications web
请考虑下面的代码示例,并关注变量赋值.由于我从未在C++中看到过这样的形式,以下是什么意思:在新的XMLHttpRequest`中"上传" .
我需要对以下陈述的含义做一个很好的解释:progress: "upload" in new XMLHttpRequest.特别是,in不存在于C++中.什么是in应该做的?
tests = {
filereader: typeof FileReader != 'undefined',
dnd: 'draggable' in document.createElement('span'),
formdata: !!window.FormData,
progress: "upload" in new XMLHttpRequest
};
Run Code Online (Sandbox Code Playgroud)
谢谢.
返回使用参数ToString(lval)调用rval的[[HasProperty]]内部方法的结果.
意思就是
(lval in rval)
Run Code Online (Sandbox Code Playgroud)
当rval是一个对象并且它具有一个名为的属性时为true String(lval).
in也用于for (... in ...)循环,但这只是类似的语法,而不是使用此运算符.
Run Code Online (Sandbox Code Playgroud)"upload" in new XMLHttpRequest
这是在问" XMLHttpRequest实例是否有一个名为'upload'的属性?" 它有效地检查此浏览器是否具有可能不存在于所有浏览器上的特定功能.
upload特别是在XMLHttpRequest Level 2中指定为支持某些事件处理程序的对象,以便您监视上载的进度:
Run Code Online (Sandbox Code Playgroud)interface XMLHttpRequestEventTarget : EventTarget { // event handlers [TreatNonCallableAsNull] attribute Function? onloadstart; [TreatNonCallableAsNull] attribute Function? onprogress; [TreatNonCallableAsNull] attribute Function? onabort; [TreatNonCallableAsNull] attribute Function? onerror; [TreatNonCallableAsNull] attribute Function? onload; [TreatNonCallableAsNull] attribute Function? ontimeout; [TreatNonCallableAsNull] attribute Function? onloadend; };