[jQuery] jQuery 3.0 からは $( document ).ready( handler ) のような書き方は推奨されない
過去のコードを眺めていてそういえばと言うことで調査しました。
> As of jQuery 3.0, only the first syntax is recommended; the other syntaxes still work but are deprecated.
>
> [.ready() | jQuery API Documentation](http://api.jquery.com/ready/)
the first syntax とは `$( handler )` ハンドラーを直接呼び出す書き方。
これだけで DOM 全体のロードが完了した時点で実行される。
“`javascript
$(function() {
// Handler for .ready() called.
});
“`
下記のような `.ready` メソッドを利用は推奨されない。
“`javascript
$( document ).ready(function() {
// Handler for .ready() called.
});
“`
このあたりも参考に。
> * [Quick Tip: Replace jQuery’s Ready() with Plain JavaScript — SitePoint](https://www.sitepoint.com/jquery-document-ready-plain-javascript/)
> * [知ってた? jQueryのready()メソッドはもう書かなくていいらしい – WPJ](https://www.webprofessional.jp/jquery-document-ready-plain-javascript/)
memo. 的に。
## 補遺
> * [[jQuery] jQuery() 関数の役割と戻り値、ページロード時の処理 | deadwood](https://www.d-wood.com/blog/2016/09/02_8428.html)
> * [[JavaScript General] immediate function pattern(即時関数) | deadwood](https://www.d-wood.com/blog/2016/08/04_8381.html)