What's the preferred way to add a DOM ready handler?

Aperta
#747 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
documentation

Direzione di ricerca

Inizia confrontando la pagina collegata su document-ready di learn.jquery.com con il riferimento ready di api.jquery.com e verifica le indicazioni attuali di jQuery. Il lavoro è completato quando il Learning Center e il riferimento API non forniscono più indicazioni contrastanti sui gestori di DOM ready.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Chapter: jquery-core help wanted

learn.jquery.com's document ready page suggests,

Experienced developers sometimes use the shorthand $() for $( document ).ready(). If you are writing code that people who aren't experienced with jQuery may see, it's best to use the long form.

However, api.jquery.com's reference suggests,

jQuery offers several ways to attach a function that will run when the DOM is ready. All of the following syntaxes are equivalent:

  • $( handler )
  • $( document ).ready( handler )
  • $( "document" ).ready( handler )
  • $( "img" ).ready( handler )
  • $().ready( handler )

As of jQuery 3.0, only the first syntax is recommended; the other syntaxes still work but are deprecated.

These suggestions feel at odds with each other. Given the deprecation notice, it seems like learn.jquery.com's suggestion is outdated.

Lingua principale
JavaScript
Stelle
914
Fork
472
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di jquery/learn.jquery.com

Tutte le issue di jquery/learn.jquery.com

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.