Contradiction about outerWidth on window between API documentation and migration guide

Aperta
#1,199 0 commenti 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
45/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
documentation

Direzione di ricerca

Leggi la documentazione dell’API di outerWidth e outerHeight insieme alla sezione della guida alla migrazione di jQuery 3.0 relativa alle dimensioni della barra di scorrimento di window. Determina quali affermazioni sono in conflitto e aggiorna la documentazione in modo che il comportamento di questi metodi su window sia descritto in modo coerente con la guida alla migrazione. Conferma che siano trattati sia outerWidth() sia outerHeight().

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

Descrizione

outerwidth() documentation currently states:

This method is not applicable to window and document objects; for these, use .width() instead.

But the jQuery 3.0 migration guide states:

Breaking change: .outerWidth() or .outerHeight() on window includes scrollbar width/height

Calls to $(window).width() return the "content width" which excludes any scrollbars that the browser has added if the content exceeds the height of the element. This is different from the width that CSS uses for media queries, which includes the width of the scrollbars. In order to provide a measure that is equivalent to the CSS media query concept of width, the $(window).outerWidth() method now returns the width including scrollbar width. This is equivalent to the DOM property window.innerWidth. The same applies for .outerHeight().

So it seems to me either the API documentation is obsolete about outerWidth() not being applicable to window, or the migration guide is wrong telling us to call outerWidth() on window to get its "CSS width". This is confusing.

There is the same trouble with .outerHeight() documentation.

Lingua principale
HTML
Stelle
324
Fork
259
Merge medio
1g 30m
PR unite (30g)
1

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/api.jquery.com

Tutte le issue di jquery/api.jquery.com

Issue simili

Altre issue su Documentation

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.