草庐IT

strict_detection

全部标签

javascript - JS : What is 'this' coercion? use-strict 和那个有什么关系?

我在网站上阅读了以下内容:Use-stricthasanadvantage.Iteliminatesthiscoercion.Withoutstrictmode,areferencetoathisvalueofnullorundefinedisautomaticallycoercedtotheglobal.Thiscancausemanyheadfakesandpull-out-your-hairkindofbugs.Instrictmode,referencingaathisvalueofnullorundefinedthrowsanerror.这到底是什么意思?use-strict

javascript - Heroku: Node 应用程序抛出 "No default language could be detected for this app"错误

我正在学习NodeJS,我正在学习的类(class)有几个项目,按部分排列。我将所有项目都放在一个主文件夹下,这也是一个gitrepository.主文件夹中的每个子文件夹本身就是一个Node项目,包含package.json和node_modules中的相关依赖项。问题是当我试图将一个这样的文件夹(todo-api)中的Node应用程序推送到heroku时,我收到以下错误-remote:Compressingsourcefiles...done.remote:Buildingsource:remote:remote:!Nodefaultlanguagecouldbedetectedf

JavaScript 'use strict' ;内部函数

在ChromeDevConsole中测试了一些js代码,我有点困惑。我知道在严格模式中,当引用this关键字时不是对象方法的函数应该接收undefined而不是全局对象.functiontest(){"usestrict";returnthis===undefined;}test();输出假。"usestrict";functiontest(){returnthis===undefined;}test();仍然错误。(functiontest(){"usestrict";returnthis===undefined;}());输出真。只是想澄清一下。ʕ•ᴥ•ʔ我是js新手。

javascript - 将 'use strict' 放在 Browserify 包中的什么位置

在Browsersifybundle(包含来自许多文件的许多模块)中,usestrict应该出现在哪里以确保整个bundle在严格模式下运行? 最佳答案 当您需要以统一的方式更改browserify输出时,答案通常是使用转换。strictify似乎可以满足您的需求。 关于javascript-将'usestrict'放在Browserify包中的什么位置,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com

javascript - QML 文本字段 : Binding loop detected for property "text"

我正在使用带有JavaScript的QML。我想知道以下错误的确切含义,以便我可以修复它:QMLTextField:Bindingloopdetectedforproperty"text"有时我的应用会给我这个警告,但我不明白 最佳答案 检测到属性fooProperty的绑定(bind)循环通常意味着您可能创建了一个相互依赖的绑定(bind)。你应该检查两件事:检查fooProperty是否绑定(bind)到某个属性,该属性在某些情况下又绑定(bind)回fooProperty。(一种循环依赖)此外,请检查是否在某些情况下,fooP

javascript - QUnit、Sinon.js 和 Backbone 单元测试受挫 : sinon spy appears to fail to detect Backbone Model event callbacks

在下面的单元测试代码中:TestModel=Backbone.Model.extend({defaults:{'selection':null},initialize:function(){this.on('change:selection',this.doSomething);},doSomething:function(){console.log("Somethinghasbeendone.");}});module("Test",{setup:function(){this.testModel=newTestModel();}});test("intra-modeleventbi

javascript - JS : detect right click without jQuery (inline)

我正在调用一个函数,它构建了一个包含多个链接的表。我想检查是否用鼠标右键或左键单击了链接。我尝试将以下部分添加到超链接。onmousedown="functionmouseDown(e){switch(e.which){case1:alert('left');break;case2:alert('middle');break;case3:alert('right');break;}}"但是如果我点击一个链接什么也不会发生。 最佳答案 html:aaa​​​​​​​​​​​​​​​​​​​​​​​​​​​JavaScript:func

javascript - ES5 "strict"和 arguments.callee

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:Whywasthearguments.callee.callerpropertydeprecatedinJavaScript?在ES5严格模式(即“usestrict”)中,引用当前函数的arguments.callee变量不再可用。对于递归函数,使用函数自己的名称显然是明智的。然而,有时我可能想使用arguments.callee的属性(即.length、.prototype)而不必使用名称当前功能。谁能解释通过删除它(据称)解决了哪些明显的问题?

javascript - "Bad Line Breaking"是否已被 "use strict"淘汰?

请假设“使用严格”;并假设JSLint已打开并且错误不能被忽略。我发现运算符和','启动的列表更具可读性,例如:vari=0,j=1,someLongVariablename1,someLongVariablename2,someLongVariablename3,someLongVariablename4;if(('dcr'===cmd&&(action)&&('get'===actionHttp||'post'===actionHttp)&&whatever){...}因此我的问题是:“BadLineBreaking”是否已因“usestrict”而过时?已编辑:“使用严格”;不会

javascript - John Resig 的简单类实例化和 "use strict"

引用:http://ejohn.org/blog/simple-class-instantiation///makeClass-ByJohnResig(MITLicensed)functionmakeClass(){returnfunction(args){if(thisinstanceofarguments.callee){if(typeofthis.init=="function")this.init.apply(this,args.callee?args:arguments);}elsereturnnewarguments.callee(arguments);};}我想知道是否有