-
-
Notifications
You must be signed in to change notification settings - Fork 542
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
more CSS cleanups #2073
more CSS cleanups #2073
Conversation
selector fixes
cleanup
cleanup
clenup
cleanup
cleanup
cleanup
cleanup
cleanup, @supports not selector(:has(a, b)) was broken
cleanup
cl;eanup
cl;enmup
issues/1971
2 typos
Thank you! Appreciate removing spaces & adding tabs Adding line breaks and spaces:
|
Whole point of more lines is making it human readable. The way it was done with cramming everything as tight as possible lead to several typos and bugs I found along the way. If you are worried about performance look into all very slow CSS rules used for theming. All the ones with wildcards are very expensive. Throwing CSS files into http://csslint.net/ will give you hints on what to look for. |
this patch still needs few tweaks, I broke something in the process of copy&paste and themes stopped working :) edit: nvm the patch is fine, some themes are just so weird I thought I broke it and panicked :] |
saw them 👍🏿
the themes' author also once prepared for more custom colors:
(i know the standard, but challenge it, at least for css & json. In conclusion readability of simple code structures could be re-defined in the world considering scrollheight & 2 dimensions
(CSS, JSON, ...) : "Excessive scroll heights (300%+)" = "human readability" ?
+("Philosophy":) no "non-required regular single spaces" should be edited by humans in code all the time. (Not worth the human time, nor storage.) (Editing tools can just add them by each individual viewer's preference (utopia. You'd state the left- and right-margin of specific chars like { and } and the color (or inherit your defaults from another language). On the scale of the world, that would still save some co2, even in efficient computers ) |
other than my last three pull request for bugs hiding in compacted code? :) Its bad and counterproductive. Computers no longer work the way this would make any practical sense to cram text tight for speed. I challenge you to measure any difference in speed or ram usage between the two. All that you wrote is contradictory to numerous UI studies. What is "Excessive scroll height"? Used 24" monitors are ~$30-50, turn it 90 degrees and you have >100 lines of text at once. I dont know any programmers complaining about scrolling. It takes 2-5x longer to read and understand bad code. |
hi @raszpl! sorry😃, i think in this optional topic it is the 3rd? time (since 2023), that i made you react about computing speed. (Which i didn't mean) and i guess this could be in chat (need not fill your PR-threads) Lets just make a blockly with a minimal theme; added spreadsheets blocks and 3D-navigation. yes, i like info-graphics & monitors square-shaped, making use of 2 dimensional space, with the vain wish for logical structures. (Rare to be found)(With Gradients of from details to overview). Or for code: from critical to never-to-be-edited-again (such prediction could save a lot of developer frustration) Short lines are more motivating to start at all in the first minutes. But if ever scrolling over megabytes of CSS or so in a row, then the short lines can equally be painful, unless the viewer likes scrolling as an e-sport So I can't think short lines are a holy grail making brains run "2-5 times" faster. (Unless the assumption would include many proofreaders searching syntax errors which should be auto-discovered)
Uncaught TypeError : Cannot Read Properties of Undefined |
for more details watch https://nolanlawson.com/2023/01/17/my-talk-on-css-runtime-performance/ Theming currently is full of worst case scenario selectors :( Crimes in order of bad:
The thing with CSS that is not very intuitive is even the rules you dont use, or are very rarely applied slow down whole page at all times. Ideally we should break Themes apart into individual themexxxx.css files and only load appropriate one. Get rid of attribute selectors, and especially attribute selectors by value.
professional programmers dont scroll :) /, ctrl-s or ctrl-f or grepping is all you need. Not to mention pagedown scrolls by >100 lines.
use dark mode in your editor :-)
Its not the length of line, its keeping logically separate things in separate lines. This: youtube/js&css/web-accessible/www.youtube.com/shortcuts.js Lines 602 to 606 in 967ccbb
is a crime, and it hides a bug that is not obvious because you cant see anything in a bungled mess :)
not syntax, logical errors. This is what cramming things close together leads to: |
Another minor crime, cant tell on first glance what is going on because indentation is all wrong: youtube/js&css/web-accessible/www.youtube.com/themes.js Lines 9 to 17 in 967ccbb
Can you tell whats happening in the next one? youtube/js&css/web-accessible/www.youtube.com/themes.js Lines 78 to 86 in 967ccbb
Crime scene, a bug is hiding in there because:
its fixed by #2076 :) |
Another good coding style template https://peps.python.org/pep-0008/ youtube/js&css/web-accessible/www.youtube.com/themes.js Lines 9 to 17 in 967ccbb
a little bit more readable |
👍👍 hi! @raszpl
( and themes include many duplicate lines same for all 6 of them (as mentioned) ) CSS performance:yes, while its convenient to allow tweaks with no JS (could even crowdsource/vote about them for any website /ublock origin could), we should avoid wastes of electricity even if minuscule per person. A relief, the mechanism for this (querying attributes of the element), should be performant. (it is available before the page is rendered.)
just for fun: #2039 |
Nesting doesnt do anything to performance https://medium.com/developer-rants/the-problem-1f121f6aecbf Its just a different way of declaring selectors. Its purely for readability, browser derives same rules when parsing.
its not about replacing CSS selectors with javascript. Its about not using the slowest selectors possible, so instead of
another explanation is https://www.zdnet.com/article/former-mozilla-exec-google-has-sabotaged-firefox-for-years/ Maybe they used slowest possible selectors to screw with Firefox knowing they work faster on Chrome.
On first glance its a good patch, havent tested it yet |
yes, just the one question remaining after tiding up the rest
and we can count/benchmark.
For readability. +It could be processed faster if there was a nested block with 1000 children. Compared to a random unsorted order. Is looking at browser code on your bucket list yet?😅
sorry, i just meant spaces still🤣 |
formatting, spaces, uncovered several typos and errors hiding in tightly bundled definitions, validated with http://csslint.net