Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

nojs enhancement #32

merged 2 commits into from Oct 5, 2012


None yet
2 participants

jamesalley commented Oct 5, 2012

This enhancement adds 6 bytes to the payload, but it's worth it. It allows a dev to assign base styles for both js and nojs cases.

Consider an menu that appears in response to a click (not hover!), but for which we desire to have a :hover fallback behavior for those with javascript off.

.menu { display: none }
.js .menu.active { display: block }
.nojs .menuTrigger:hover .menu { display: block }

WIthout the .nojs flag, one would have to write:

.menu { display: none }
.menuTrigger:hover .menu { display: block }

/* to prevent showing the menu on hover in the js case */
.js .menuTrigger:hover .menu { display: none }

.js .menuTrigger:hover .menu.active { display: block }

That's more verbose and less clear. It's just one example of why it's good to have an initial "nojs" flag.

Thanks Diego!

jamesalley added some commits Oct 5, 2012

Clearer distinction between js and nojs cases
This allows for the positive javascript:off case. It gives a CSS author a lot more flexibility and power by allowing the developer to create default styles applicable to both js and nojs cases, then augment specifically for either case.

For instance, you might want :hover styles for the .nojs case that you don't need for the .js case.

This helps isolate the two cases from each other, yet lets them share rules common to them both. 

End result is much clearer and more concise CSS, and easier handling of .nojs edge cases. It's worth the extra six bytes.
Update mojits/ShakerHTMLFrameMojit/views/index.mu.html
Clearer distinction between js and nojs cases which allows either case to share base styles. Results in cleaner, clearer, more consise css and better, easier handling of nojs edge cases.

diervo added a commit that referenced this pull request Oct 5, 2012

@diervo diervo merged commit 77990a7 into YahooArchive:master Oct 5, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment