jQuery コードを JavaScript に変換する簡単な方法はありますか? [closed] 質問する

jQuery コードを JavaScript に変換する簡単な方法はありますか? [closed] 質問する

Is there an easy way to convert jQuery code to regular javascript? I guess without having to access or understand the jQuery source code.

ベストアンサー1

This will get you 90% of the way there ; )

window.$ = document.querySelectorAll.bind(document)

For Ajax, the Fetch API is now supported on the current version of every major browser. For $.ready(), DOMContentLoaded has near universal support. You Might Not Need jQuery gives equivalent native methods for other common jQuery functions.

Zepto offers similar functionality but weighs in at 10K zipped. There are custom Ajax builds for jQuery and Zepto as well as some micro frameworks, but jQuery/Zepto have solid support and 10KB is only ~1 second on a 56K modem.

おすすめ記事