-
Bug
-
Resolution: Fixed
-
Major
-
2.1 Final
-
None
-
JavaScript (in all browsers)
We are integrating our own JavaScript effects into a Magnolia website, but finding that the Magnolia gui admin JavaScript is being broken when we do so.
Many third party JavaScript libraries implement features by adding 'prototype' methods to inbuilt JavaScript objects. For example, adding the 'push' method to the Array object for browsers that don't have it.
A side effect of adding prototype methods to the array object is that the new method is then visible when the array is iterated via a "for (i in arr)" loop. It is therefore advisable to avoid that style of loop, but to use "for (i=0; i<arr.length; i++)" instead.
I've found one place this needs to be fixed, namely on line 343 in:
/admindocroot/js/general.js
Old line:
for (var elem in qs)
Fixed version:
for (var elem=0; elem<qs.length; elem++)