Il codice qui non restituisce quello che ci si aspetta:È JQuery (..). Html() bacato in jQuery 1.3.2?
jQuery('<div>Look here: [ jQuery0="null" ]</div>').html()
Piuttosto, si ottiene:
Look here: [ ]
Il codice sorgente di jQuery in questione:
html: function(value) {
return value === undefined ?
(this[0] ?
this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") :
null) :
this.empty().append(value);
},
Quale sarebbe la motivazione dietro lo .replace
? Non ho tempo di esaminare il resto di jQuery, ma codice come questo mi fa pensare se dovrei usare jQuery in produzione.
Concesso, non ha ancora influenzato il mio codice ma interrompe l'invariant 'x.html (y) .html() == y', che suona un campanello d'allarme. Grazie per le informazioni su quando è stato introdotto. Hai ragione, non è un bug, ma una decisione progettuale discutibile. – t0yv0