Force yourself to learn JavaScript.
| // If you're a glutton for punishment, and/or claim | |
| // that JavaScript libraries have too much "bloat", | |
| // use this to force yourself to write JS longhand. | |
| (function(window) { | |
| function screwed() { | |
| window._ = null; | |
| window.$ = null; | |
| window.$A = null; | |
| window.$F = null; | |
| window.$H = null; | |
| window.$R = null; | |
| window.$w = null; | |
| window.$defined = null; | |
| window.$type = null; | |
| window.$merge = null; | |
| window.$extend = null; | |
| window.$native = null; | |
| window.$chk = null; | |
| window.$pick = null; | |
| window.$random = null; | |
| window.$time = null; | |
| window.$clear = null; | |
| window.$$ = null; | |
| window.dojo = null; | |
| window.Ext = null; | |
| window.jQuery = null; | |
| window.SC = null; | |
| window.YAHOO = null; | |
| window.YUI = null; | |
| window.Zepto = null; | |
| window.setTimeout(screwed, 100); | |
| } | |
| screwed(); | |
| })(this); |
This comment has been minimized.
This comment has been minimized.
padolsey
commented
May 26, 2011
|
The worst offenders won't be affected by this though :( ... I'm talking of those who dare to encroach upon the sanctity of unaltered DOM/BOM prototypes. MOOTOOLS... PROTOTYPE... Those bastards. |
This comment has been minimized.
This comment has been minimized.
|
True. I mean, the DOM remains extended/polluted, but good luck trying to use the "getters" of $ or $$. Which reminds me, added: $A, $F, $R, $w too. :) |
This comment has been minimized.
This comment has been minimized.
Harvie
commented
May 31, 2011
|
Nice. I can imagine this as Chromium or Firefox plugin (or bookmarklet at least) :-D |
This comment has been minimized.
This comment has been minimized.
KTibow
commented
Jun 10, 2020
•
|
Short-hand one-time alternative: window._ = window.$ = window.$A = window.$F = window.$H = window.$R = window.$w = window.$defined = window.$type = window.$merge = window.$extend = window.$native = window.$chk = window.$pick = window.$random = window.$time = window.$clear = window.$$ = window.dojo = window.Ext = window.jQuery = window.SC = window.YAHOO = window.YUI = window.Zepto = null;Or even shorter: _=$=$A=$F=$H=$R=$w=$defined=$type=$merge=$extend=$native=$chk=$pick=$random=$time=$clear=$$=dojo=Ext=jQuery=SC=YAHOO=YUI=Zepto=null;For self-calling: function z7(){_=$=$A=$F=$H=$R=$w=$defined=$type=$merge=$extend=$native=$chk=$pick=$random=$time=$clear=$$=dojo=Ext=jQuery=SC=YAHOO=YUI=Zepto=null;setTimeout(z7,9);}z7();And pretty much ruin most scripts: function z7(){_=$=$A=$F=$H=$R=$w=$defined=$type=$merge=$extend=$native=$chk=$pick=$random=$time=$clear=$$=dojo=Ext=jQuery=SC=YAHOO=YUI=Zepto=document.getElementById=document.getElementByClassName=document.getElementByName=document.getElementByTagName=document.getElementByTagNameNS=null;setTimeout(z7,9);}z7(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
mathiasbynens commentedMay 23, 2011
Evil indeed! :) You could rewrite this as
$ = $$ = dojo = Ext = jQuery = SC = YAHOO = YUI = Zepto = null;if you wanted to.