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.

93 questions
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
  • 371
  • 1
  • 3
  • 18
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
  • 10,707
  • 7
  • 51
  • 67
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
  • 48,336
  • 43
  • 154
  • 235
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…
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
  • 5
  • 19
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
  • 366
  • 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
  • 23,672
  • 19
  • 120
  • 191
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
  • 2,809
  • 3
  • 25
  • 40
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…
0
votes
1 answer

can local variables inside a sealed object pass information to global variables?

Not sure if I'm wording this correctly but can local variables inside a sealed object pass information to global variables?
Kahless
  • 1,113
  • 2
  • 11
  • 30
0
votes
1 answer

Android StrictMode: False positive or what is wrong with this sample?

I have this ToggleButton that is enabled when a certain condition (Website content) is true. getSystemOnState(..) connects to a webserver and this causes an exception because of strict mode. What is wrong about the way I am using the Handler…
PhilW
  • 731
  • 6
  • 19