#2098 closed enhancement (fixed)
'use strict' in JavaScript
Reported by: | Nicklas Nordborg | Owned by: | Nicklas Nordborg |
---|---|---|---|
Priority: | minor | Milestone: | BASE 3.12 |
Component: | web | Version: | |
Keywords: | Cc: |
Description
By adding 'use strict';
to the top of a JavaScript file we can tell the JavaScript engine to not allow some unsafe usage. For example, using a variable without declaring it (for example, due to a typo). This will create safer and more robust code.
For more information see: https://www.w3schools.com/js/js_strict.asp
While the change is simple to implement it requires a lot of testing to check that nothing is broken by it. Luckily it is possible to do this per file (or even per function) so we don't have to do it all at the same time.
Change History (14)
comment:1 by , 7 years ago
Milestone: | BASE Future Release → BASE 3.12 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 7 years ago
comment:3 by , 7 years ago
(In [7420]) References #2098: 'use strict' in JavaScript
Fixed on the login/logout page and some of the common functionality/utilities for sharing, running plug-ins, etc.
No problems found, except that the "Zoom" page lacked the "Cancel" button.
comment:4 by , 7 years ago
(In [7429]) References #2098: 'use strict' in JavaScript
Fixed all remaining scripts in the /common. Found a single issue in the "Save columns preset" dialog that caused the preset to be displayed with an incorrect name.
comment:5 by , 7 years ago
(In [7430]) References #2098: 'use strict' in JavaScript
Fixed in the /info and /my_base folders.
comment:6 by , 7 years ago
(In [7432]) References #2098: 'use strict' in JavaScript
Fixed /views folder
comment:7 by , 7 years ago
(In [7434]) References #2098: 'use strict' in JavaScript
Fixed /plugin and /filemanager folders
comment:8 by , 7 years ago
(In [7438]) References #2098: 'use strict' in JavaScript
Fixed /biomaterials folder
comment:9 by , 7 years ago
(In [7439]) References #2098: 'use strict' in JavaScript
Fixed /lims folder
comment:10 by , 7 years ago
(In [7448]) References #2098: 'use strict' in JavaScript
Fixed some in the /admin folder.
comment:11 by , 7 years ago
(In [7449]) References #2098: 'use strict' in JavaScript
Fixed more in the /admin folder.
comment:12 by , 7 years ago
(In [7450]) References #2098: 'use strict' in JavaScript
Fixed remaining scripts in the /admin folder. I think this was the last ones.
comment:13 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:14 by , 7 years ago
(In [7457]) References #2098: 'use strict' in JavaScript
Found one more undefined variable.
(In [7419]) References #2098: 'use strict' in JavaScript
Fixed in the common scripts. Most worked without problems. Only some minor adjustments: