The last example on "How to Create a Basic Plugin" returns a different result than the previous example.

Aperta
#739 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@Jeff-Schafer ci sta già lavorando.

Dal 16/1/2017.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
55/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
javascript, jquery
Ambito
documentation

Direzione di ricerca

Apri la lezione «Basic Plugin Creation» all’URL collegato e confronta l’esempio finale ottimizzato con l’esempio precedente e con il primo esempio di «Putting It Together». Aggiorna l’esempio e la nota sul recupero di href in modo che il risultato visualizzato e la spiegazione siano coerenti, quindi verifica che gli esempi della lezione producano l’output documentato.

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

Descrizione

Chapter: plugins

The last example on https://learn.jquery.com/plugins/basic-plugin-creation/ says:
"Our plugin can be optimized though:"
and shows the "optimized" code.

But the example before it, when run, just appends the text in the href for that tag, & this "optimized" code appends the full path to where the .html file is to what is in the href for that tag.

The first example under the "Putting It Together" correctly appends "page.html" to the text between the tags.
---> Foo (page.html)

Using a local .html file (like on the Desktop), the "optimized" returns:
---> Foo file:///C:/users/..../Desktop/page.html (without the parentheses, unlike in the first example).

Below the last example, it says:
"Notice also that we're not using the .attr() method to retrieve the href attribute, because the native DOM API gives us easy access with the aptly named href property."

To make it have the same results as the first example in this section "this.href" needs to be replaced with "$(this).attr("href")".

This will contradict the text mentioned above ("not using the .attr() method"), and needs to be updated.

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.