-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove assertion debug code for show/hide refactoring #23576
Remove assertion debug code for show/hide refactoring #23576
Conversation
I guess these few weeks since it was added was already enough. Glad to see it go 😉 |
I wouldn't assume it's "enough" at the moment. 1.19 hasn't been released, I am not sure that whether users would report related "show/hide" bugs. |
Well then let's skip the backport and this will get more than enough testing through that :) |
Haven't seen related reports for a while, let's clean the assertion code and get this in 1.19.1? |
if (force === true) { | ||
el.classList.remove('gt-hidden'); | ||
assertShown(el, true); | ||
} else if (force === false) { | ||
el.classList.add('gt-hidden'); | ||
assertShown(el, false); | ||
} else if (force === undefined) { | ||
const wasShown = window.config.runModeIsProd ? undefined : isShown(el); | ||
el.classList.toggle('gt-hidden'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't that be simplified now to el.classList.toggle('gt-hidden', force)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably can but I guess it may be slower then explit add/remove. But would need to check how browsers implement toggle.
Probably does not matter though, as the difference ought to be tiny.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe one day we should make it work with official hidden
attribute together, because the [hidden]
is standard.
Then we need to remove (in show) and check (in toggle) the hidden
attribute. Then such if
blocks would help.
Codecov Report
@@ Coverage Diff @@
## main #23576 +/- ##
==========================================
- Coverage 47.14% 46.98% -0.16%
==========================================
Files 1149 1158 +9
Lines 151446 153187 +1741
==========================================
+ Hits 71397 71982 +585
- Misses 71611 72716 +1105
- Partials 8438 8489 +51
... and 72 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
🤖 🎺 |
When doing the refactoring: * go-gitea#22950 I added some debug mode code (assertShown) to help to catch bugs, it did catch some bugs like: * go-gitea#23074 If it has been proved that there is no more bugs, this assertion could be removed easily and clearly. Feel free to decide when to remove it (feel free to convert it from Draft to Ready for Review). cc: @silverwind
Backport #23576 by @wxiaoguang When doing the refactoring: * #22950 I added some debug mode code (assertShown) to help to catch bugs, it did catch some bugs like: * #23074 If it has been proved that there is no more bugs, this assertion could be removed easily and clearly. Feel free to decide when to remove it (feel free to convert it from Draft to Ready for Review).
* upstream/main: [skip ci] Updated translations via Crowdin Update JS deps (go-gitea#23853) Added close/open button to details page of milestone (go-gitea#23877) Check `IsActionsToken` for LFS authentication (go-gitea#23841) Prefill input values in oauth settings as intended (go-gitea#23829) Display image size for multiarch container images (go-gitea#23821) Use clippie module to copy to clipboard (go-gitea#23801) Remove assertion debug code for show/hide refactoring (go-gitea#23576) [skip ci] Updated translations via Crowdin Remove jQuery ready usage (go-gitea#23858) Fix JS error when changing PR's target branch (go-gitea#23862) Improve action log display with control chars (go-gitea#23820) Fix review conversation reply (go-gitea#23846) Improve home page template, fix Sort dropdown menu flash (go-gitea#23856) Make first section on home page full width (go-gitea#23854) [skip ci] Updated translations via Crowdin Fix incorrect CORS failure detection logic (go-gitea#23844)
When doing the refactoring:
.hide
class, remove inline style=display:none #22950I added some debug mode code (assertShown) to help to catch bugs, it did catch some bugs like:
If it has been proved that there is no more bugs, this assertion could be removed easily and clearly.
Feel free to decide when to remove it (feel free to convert it from Draft to Ready for Review).
cc: @silverwind