CSS variable stripped from calls to jQuery .css()
Una pull request collegata è già stata integrata.
- #180 di @Krinkle — integrata
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, jquery
- Ambito
- frontend
Direzione di ricerca
Start with jQuery Core's .css() path and the vendored jQuery Color plugin's color cssHooks, then reproduce the provided CSS-variable test case with jQuery UI loaded. Done means setting and reading var(--color-base, #202122) preserves the CSS variable expression and does not replace it with an rgb() fallback.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I found an odd behavior in the jQuery Core .css() function when passing values that contain CSS variables, with a color value as fallback. This bug only happens when jQuery UI is also loaded on the page, and seems to be caused by the jQuery Color plugin (as vendored by jQuery UI) and its cssHooks for converting colors to rgb() notation.
Test case
$('<div>').css('color', 'var(--color-base, #202122)').css('color');
Expected
If you run this e.g. on https://jquery.com where jQuery UI is not loaded, it returns var(--color-base, #202122).
Actual
If you run it on https://jqueryui.com/resources/demos/draggable/default.html where jQuery UI is present, it returns rgb(32, 33, 34).
This is not limited to the return value, the style attribute itself is altered so this happens during the setting, not the getting.
The impact is that when you later attach the element to the document, where the CSS variable exists in a stylesheet, its value will not be used, and instead the fallback is always used.
This was found downstream at Wikipedia (https://phabricator.wikimedia.org/T391461), where we found theme variables (especially dark mode) causing some challenging color combinations. The issue only happened on the subset of forms where jQuery UI is loaded by something elsewhere on the page.
- Lingua principale
- JavaScript
- Stelle
- 11.3k
- Fork
- 5.2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di jquery/jquery-ui
-
Selectmenu changes selection after its native select is disabled while openForse già presa @Xapollon430 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Datepicker changes a natively disabled input if its calendar is openForse già presa @Xapollon430 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
-
Behavior shared with 1.12 Comp: Datepicker
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Comp: Datepicker Needs info
Difficoltà 3/5 1-2 giorni Idoneità per principianti 53/100
-
Needs info
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
Tutte le issue di jquery/jquery-ui
Issue simili
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
coder/claudecode.nvim#588 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
digitalbazaar/http-client#60 ·
-
Ruby: The link in the Blocks lesson points to an external article that isn't at that address anymoreAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
TheOdinProject/curriculum#31529 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
topmonks/hlidac-shopu#3687 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ONLYOFFICE/DocumentServer#3912 · 1 commento ·