Ensure compatibility with JavaScript Strict mode
HighCharts is not compatible with Javascript Strict mode because it leaks variables to the global namespace.
Running JavaScript in strict mode is a business requirement to enhance security and stability: "strict" operating context prevents certain actions from being taken and throws more exceptions:
- It catches some common coding errors, throwing exceptions, instead of silently running.
- It prevents, or throws errors, when relatively "unsafe" actions are taken (such as gaining access to the global object).
- Strict mode code can sometimes run faster.
As an example, this function in HighCharts:
dSetter: function (value, key, element) {
// some code
this[key] = value;
}
Is called with a null context:
setter.call(
null,
// some code
);
In a non-strict mode, you can see that this variable is leaked:
window.d
And in strict mode, an error is shown:
SyntaxError: Strict mode does not allow function declarations in a lexically nested statement
Highcharts 5 implements strict mode.
-
Pintu Francis commented
Thank you for the update. This helps a lot.
-
JF Paradis commented
Thanks Torstein. I have forwarded the information to the interested parties. This is excellent.
-
This is an excellent suggestion, thank you for your feedback.
-
Aravind Ajith commented
I would like to have this functionality (fully functional in strict mode).
Highcharts being a very popular and an exceptional JavaScript library, it'll not only help in making it fully functional in Salesforce1 lightning, it'll also help in supporting other platforms in the future, as security has now become a major concern.
Please take this into account in the next release. Thank you.
-
Rejith Varma commented
Will definitely help everybody who creates apps using High Charts in Lightning Framework.
-
Anonymous commented
We want to use HighCharts with Salesforce1 Lightning framework. This will help making the app more secure for all our enterprise customers.
-
Pintu Francis commented
Much needed for enforcing secirity in next level apps. Awaiting fully strict mode version for using in Salesforce1 Lightning Component Framework.