Il nuovo jQuery 2.0.2 aggiunge l'attributo "stile" al tag body nella struttura DOM. C'è qualche ragione specifica?Perché jQuery 2.0.2 aggiunge l'attributo di stile vuoto al corpo
Printscreen:
Il nuovo jQuery 2.0.2 aggiunge l'attributo "stile" al tag body nella struttura DOM. C'è qualche ragione specifica?Perché jQuery 2.0.2 aggiunge l'attributo di stile vuoto al corpo
Printscreen:
Anche se questo in realtà non pregiudica nulla è ancora una domanda valida.
il motivo è questo codice:
// Workaround failing boxSizing test due to offsetWidth returning wrong value
// with some non-1 values of body zoom, ticket #13543
jQuery.swap(body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
support.boxSizing = div.offsetWidth === 4;
});
Questo è solo un test per boxSizing supporto. jQuery.swap()
è descritto nell'origine come:
Un metodo per scambiare rapidamente le proprietà CSS in/out per ottenere calcoli corretti.
body.style.zoom != null ? { zoom: 1 } : {}
rendimenti zoom: 1
se body.style.zoom
è nonnull
e un oggetto vuoto se è. Il valore restituito viene quindi applicato all'elemento body
, motivo per cui ha un tag vuoto style
.
In realtà per display: tipo di tabella corpo –