Questions tagged [strict-mode]

According to Mozilla Developer Network, ECMAScript 5's strict mode is a way to opt in to a restricted variant of JavaScript. Strict mode isn't just a subset: it intentionally has different semantics from normal code.

According to Mozilla Developer Network, ECMAScript 5's strict mode is a way to opt in to a restricted variant of JavaScript. Strict mode isn't just a subset: it intentionally has different semantics from normal code.

112 questions
0
votes
2 answers

getting can't read property 'any' type error when we script in strict mode

while using strict mode I'm getting type error to access the var using this. "use strict"; var bar = "global"; function foo() { console.log(this.bar); } var obj1 = { bar: "obj1", foo: foo }; var obj2 = { bar:…
0
votes
0 answers

Why using this is not legal in strict mode

I have the following code : (function () { 'use strict'; angular.module('gestion').controller( 'controller', controller); controller.$inject = ['$mdDialog', 'locals']; function controller($mdDialog,…
Renaud is Not Bill Gates
  • 1,684
  • 34
  • 105
  • 191
0
votes
4 answers

How to enable strict mode globally in AngularJS?

I spent a lot of time debugging a program, thinking I couldn't do something when my only mistake was to having switched the case of a variable name. I can enable strict mode (AKA, no undeclared variable can be used) per file by typing "use strict";…
user96649
  • 471
  • 1
  • 5
  • 22
0
votes
4 answers

howto remove current eventListener in JS strict mode (without callee)

The problem : an event listener wants to remove itself from the target listeners list. The listener can be an anonymous function and/or dynamicaly generated (closure or bind) Here is a solution (doesn't work in "mode strict") : (exemple for "click"…
Brn--
  • 1
0
votes
1 answer

exports is not defined when running node.js script using vm in strict mode

I see this code in many modules: var app = exports = module.exports = {}; But I have some problem executing these modules using Node.js VM in strict mode. Here a demonstration: var code = ` 'use strict'; // Works if I remove this line var app =…
Davide Icardi
  • 11,919
  • 8
  • 56
  • 77
0
votes
1 answer

delete HTMLElement in strict mode

I have a not so small image and I pre-loaded it like this. //cache the poster var img = document.createElement("img"); img.src = "http://lorempixel.com/300/200"; // to make sure the poster is loaded before the video player…
naveen
  • 53,448
  • 46
  • 161
  • 251
0
votes
0 answers

Why do browsers allow some global variables in the strict mode?

I cannot figure it out, why do some browsers allow the next code, and others do not: 'use strict'; (function() { Number = 1; toString = 1; valueOf = 1; })(); console.log(Number); console.log(toString); console.log(valueOf); Chrome 52 on…
d.k
  • 4,234
  • 2
  • 26
  • 38
0
votes
0 answers

Typescript promise bind angular 1.5

I am having a problem that my promise isn't being bound to the correct this. I have read many articles on this subject and I think I understand the problem, but the solution isn't clear. Suggestions Here is the code: // AngleCouch.ts`enter code…
0
votes
1 answer

Why is my JavaScript not working correctly in strict mode on Safari?

I have built a website that uses some simple JavaScript. After some testing, I have found that my JavaScript is behaving very differently on iOS devices as compared to all other devices that I could test with. After several hours of trial-and-error,…
JacksonHunt
  • 582
  • 6
  • 21
0
votes
2 answers

Weird IE6/IE layout bug

I've had quite a few problems with IE6 and our website. http://www.sweetlets.com/w/solutions/click-stream/features/ At the very top the teaser boxes have scrollbars in IE6, but not IE7, IE8, FF or Chrome. Does anyone have an explanation for…
Czar
  • 356
  • 1
  • 4
  • 21
0
votes
0 answers

Why escape characters are not allowed in strict mode?

Why is escape characters not allowed in javascript strict mode? "use strict"; var y = \010; //Uncaught SyntaxError: Unexpected token ILLEGAL

Check browser console for errors

Zameer Ansari
  • 28,977
  • 24
  • 140
  • 219
0
votes
2 answers

unable to resolve method using strict-mode with object type

Yesterday I post a question on strict-mode when passing different types of parameter to a function an laune find a solution. As recommend, I now use drools version 5.6. Now, I still have the strict-mode error but for another case. Unfortunately, I…
Alain Tanguay
  • 43
  • 1
  • 2
  • 5
0
votes
1 answer

strick mode breaks android parent activity state

If this question seems not specific enough or too specific, it's because I am trying this advance feature that I don't understand much about. I want to be a great developer. So I set my phone to strict mode so I can test my app (my app works great…
0
votes
1 answer

Where must "use strict" be set to trigger strict-mode errors on frozen objects?

Since ES5 we can use Object.freeze() to lock objects. But if you run JS in sloppy-mode any writing to the properties fails silently, unless you activate strict-mode. But where do you need to set this? I use a module system (node.js/amd) so there…
Bartvds
  • 3,340
  • 5
  • 30
  • 42
0
votes
3 answers

Strict Mode "A resource was acquired at attached stack trace but never released" exception with Google Map

Im getting the following exception on strict mode when starting my app. Just after my login activity is closed and right before my main activity, which contains a SupportMapFragment, is displayed. 10-29 16:11:22.605: E/StrictMode(1121): A resource…