Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Part of the JavaScript selectors clean-up effort.
#1574470: Selectors clean-up
#1415788: Javascript winter clean-up
Comment | File | Size | Author |
---|---|---|---|
#31 | interdiff.txt | 912 bytes | pguillard |
#31 | selectors_clean_up-1751434-31.patch | 12.18 KB | pguillard |
#29 | selectors_clean_up-1751434-29.patch | 12.52 KB | lauriii |
#27 | selectors_clean_up-1751434-27.patch | 13.53 KB | lauriii |
#27 | interdiff.txt | 7.46 KB | lauriii |
Comments
Comment #1
nod_performance sensitive script, see if it can be made better.
Comment #2
oxyc CreditAttribution: oxyc commentedHere's an initial cleanup patch
Comment #3
oxyc CreditAttribution: oxyc commentedComment #4
oxyc CreditAttribution: oxyc commentedHad a typo on keyup.
Comment #5
oxyc CreditAttribution: oxyc commentedThis could probably be further simplified into:
----
This is probably the most intensive operation but I dont really see a way to optimize it.
Comment #6
oxyc CreditAttribution: oxyc commentedI changed the .each into a simple .after()
Comment #7
nod_user.js:
Can you make the
passwordCheck
,passwordCheckMatch
functions into named functions?I'd rather have that as:
user.permissions.js:
can you separate the .once() call and the function in there? there is no need for this closure. Have a look at other core scripts to see what I mean (yay! can finally say that with some confidence :).
Beside that it's all good :) thanks a lot!
Comment #8
oxyc CreditAttribution: oxyc commentedNice, thanks.
This also saved us from a global pollution, didn't think about passwordCheckMatch() populating
this
with a variable and then being called as a global function. Jshint didn't catch it as a function expression either, quite odd.A good reason for these new conventions :)
So my solution is just to remove both possible classes before adding a new one, without checking if it exists or not. If you prefer using a closure to memorize, I'll revise it.
Comment #9
oxyc CreditAttribution: oxyc commentedComment #10
nod_tag
Comment #11
droplet CreditAttribution: droplet commentedGive a better name ? eg $passwordInputParent.
no space "function()"
add event namespaces ? should it bind "change" event ? and "input" event for IME
can we call it $usernameInput
Comment #12
droplet CreditAttribution: droplet commentedI will update it when #1684880: JSHint user get commited
Comment #13
droplet CreditAttribution: droplet commentedToo many changes, won't attach an interdiff.
Comment #15
droplet CreditAttribution: droplet commented#13: user.d8.patch queued for re-testing.
Comment #16
droplet CreditAttribution: droplet commentedComment #17
nod_Stray semi-colon in user.persmissions.js
the
$dummy
change looks good, you're right, no need to clone it.The selector can even be transformed to be
works the same for me.
Changes to user.js looks good :)
Comment #18
droplet CreditAttribution: droplet commentedI found it in user.js
2. the selectors transform I leave as it, no diff.
Comment #19
droplet CreditAttribution: droplet commentedNothing is perfect, Move On!.
Comment #21
droplet CreditAttribution: droplet commentedTry again, it applied locally
Comment #22
Manuel Garcia CreditAttribution: Manuel Garcia commentedComment #23
pguillard CreditAttribution: pguillard commentedRe-rolled!
Comment #24
nod_Seeing a few ESLint errors:
Comment #25
pguillard CreditAttribution: pguillard commentedI applied #24 corrections.
No clue for the indicatorClass warning
Comment #26
lauriiiComment #27
lauriiiComment #28
nod_Need reroll :/
Looks good though.
Comment #29
lauriiiComment #30
nod_indicatorColor
is not used, why do we need that one, is anything else using it?eslint error on the user.permission.js file.
Comment #31
pguillard CreditAttribution: pguillard commentedI have problems with eslint, but here's what I suggest..
Comment #32
nod_Looks good to me, eslint is happy.
Password is working as expected. Permission page too.
Comment #34
alexpottI've reviewed this and manually tested - all looks okay. Not the easiest issue to review as the changes seem to be from multiple scopes - internal clean ups and new js specific classes. Ideally this would be done in separate issues.
Given that we are preceding with other issues that add the
js-
I'm going to commit this patch as part of that effort. However, in future it would be great if the scope of the these patches could be reduced to just doing the necessary to do that. Committed 74363f6 and pushed to 8.0.x. Thanks!