- + JavaScript の質問用スレッド vol.126 +
355 :デフォルトの名無しさん[sage]:2018/11/09(金) 18:34:41.79 ID:ya9Twat2 - >>349
> document.querySelectorAll() を > $() とかけるだけで、素晴らしいって思うだろうねw document.querySelectorAll()を$()と書けるようにする方法 方法1: var $ = document.querySelectorAll.bind(document) (48文字、minifyで46文字) 方法2: jQueryのロード (minify + gzipで約30,000文字w) ブラウザがgzip解凍後の約85,000文字のjsで書かれたjQueryコードをパース、コンパイルwww 結構な時間です https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/javascript-startup-optimization/#parsecompile
| - + JavaScript の質問用スレッド vol.126 +
359 :デフォルトの名無しさん[]:2018/11/09(金) 20:25:53.76 ID:ya9Twat2 - >>349
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> jQueryおじさん「ワアッ!短い!たった88文字!どーだ参ったか!」 var $=document.querySelectorAll.bind(document) (46文字) document.querySelectorAll() を $() と書けるようにしたいだけで88文字かけて85,000文字のコードをロード、パース、コンパイルさせるjQueryおじさん仕事できなさそうwwwww ゴキブリ倒すのに戦車持ってくるみたいなwwwww
|
|