function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdcfoxsfdcfox 

Is Visualforce ECMA5 Strict compliant?

If I "use strict" in my code, will Visualforce Remoting blow up? Has anyone tried testing this to see what will happen? Are there any gotchas I should be made aware of?

 

I tried something like this:

 

"use strict";
(function(window,undefined) {
  var addEvent = function(...) { ... };
  var callbackHandler = function(...) { ... };

  var onWindowLoad = function(...) {
     Visualforce.remoting.Manager.invokeAction(
       "{!$RemoteAction.myClass.myMethod}",
       callbackHandler);
  };
  addEvent(window,"load",onWindowLoad,true);
})(window);

Where ... is not relevant. It runs, and the data comes back just fine, but I wanted some feedback on if there were any known issues where it might be possible that remoting fails entirely because of strict mode, perhaps even outside the realm of being able to use exception handling. Or, should I just forego strict mode and leave that for another day?

Peter_sfdcPeter_sfdc
This is a really good question, and deserves a definitive answer. I'm going to enquire with the VF team and come back with the response.