This is a jQuery 1.3.2 version of mine, made to work in the presence of Object.prototype
(ab)use.
1 |
https://dbj.org/jquery.1.3.2.safe.slow.js |
The primary use of this is for people who have a task to switch legacy sites to use jQuery, and/or some of the modern javascript libraries. Like jQuery UI, for example. None of which works correctly if “someone” has an extended Object.prototype object.
If you are one of these unfortunate souls, please let me know what do you think? It seems to work for me with (for example) this :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<script src="https://dbj.org/jquery.1.3.2.safe.slow.js" type="text/javascript"></script> <script type="text/javascript"> // < ![CDATA[ // testing safe and slow jQuery version ... function is_it_safe () { Object.prototype.my_abuse = function() { }; Object.prototype.my_abuse2 = "!!!" ; Object.prototype.$ = "!!!"; } $( function () { is_it_safe() ; } ); // ]]></script> |
Code above makes pure and original jQuery
fail immediately upon load. The idea is for you to use this “safe and slow” version until you remove all the legacy code. Then you simply switch back to the original jQuery
and proceed accordingly. So the primary use of this jQuery
version is for the transition of legacy sites and javascript code to the full usage of jQuery
.
NOTE 1: absolutely no optimization has been done in the implementation
of the idea. Feel free to post your optimised versions.
NOTE 2: If you are in control of the management of the modernisation of the legacy site, you can always reset Object.prototype
, like this :
1 |
for (var j in Object.prototype) delete Object.prototype[j] ; |
If your legacy code still works after this, you probably do not need this safe and slow version.
— DBJ