Live data from Hacker News

CSS is powerful, you can do a lot of things without JS

github.com

231–240 of 319 posts

Re: CSS is powerful, you can do a lot of things without JS

#231

Earlier quoted context omitted.

The W3C's job is to standardize implementations. Most standards bodies do not invent on their own. In any case, a standards body will generate the fundamentals allowing the ability to piece together components to create what a developer wants. No standards body is able to come up with every desire of every developer.

The point is: Usually, you must know the rules to break them. In this particular context, looks like the original rules are fading away. No rules = Anarchy.

Nitpick, but anarchism is not the lack of rules, it's the lack of rulers.

Re: CSS is powerful, you can do a lot of things without JS

#233

Earlier quoted context omitted.

Dunno. But my niece and nephew are tablet/phone experts, and have never used a mouse. And they are 4 and 6.

If it comforts you, I used an upside-down SNES gamepad for a few years before ever touching a mouse. And today I use my mouse far more than any game controllers.

I'm more curious why it was upside down.

Re: CSS is powerful, you can do a lot of things without JS

#234
post #81

Most of these are just clever CSS hacks. There is a website collecting these kind of experiments since the early '00: http://www.cssplay.co.uk/ There was a time when separation of concerns and the "Rule of Least Power"[0] where the foundation principles of web development. Today you have preprocessors, postprocessors, transpilers, content and style in JavaScript, behavior in CSS. Very powerful tools that can easily l…

Hmmm... .accordion .content { padding:0 10px; overflow:hidden; border:1px solid #fff; -webkit-transition: all .5s ease-out; -moz-transition: all .5s ease-out; } -webkit-transition, -moz-transition... it's like we're at 180 degrees to where the web was in the days of IE4-6

The browser prefixes haven't been necessary on transition for almost 3 years now:

http://caniuse.com/#search=css%20transition

This is just a webdev with old habits that isn't staying current.

Re: CSS is powerful, you can do a lot of things without JS

#235
post #44

I prefer using CSS for my styling and javascript for my functionality, as God intended. These examples could be educational for getting a bit more out of your CSS while keeping only the pure functionality in javascript. Too much styling-related stuff seems to be sneaking into code these days. I like my concerns separated.

> I prefer using CSS for my styling and javascript for my functionality

To play devil's advocate, though... is an accordion or a carousel "functionality" any more than, say, a drop-down or a multi-line input box is? I mean, the games examples are pretty wacky (in a cool but "thank God I don't have to debug these" way), but things like tabs and tree views are so ubiquitous that a case could be made for having standard HTML input tags for them.

Re: CSS is powerful, you can do a lot of things without JS

#236
post #36

I think it would actually be wise to stick to JS style rendering (as is the case with React) as we're only going to see more and more styling being delegated to scripts with the rise of wasm. Only a matter of time before CSS will only really be useful for completely static websites IMO. Edit: Downvoting me because you disagree isn't really in the spirit of HN. Please provide a counter argument if you disagree, I'd be…

It would actually be wise to arm special forces with laptops, as we're only going to see more and more operations depending on hacking into security systems and building automation systems with the rise of smart devices that have no business being on the web (aka IoT). Only a matter of time before guns will only really be useful in third world countries without electricity.

So, are you saying that a bunch of guys with wire cutters and guns would be unstoppable? Simple scenario:

1. Cut all the power (grid connections A, B and C, disable generators) - nobody says no if you ask nicely and have a big gun 2. Watch the special teams struggle helplessly to hack into offline systems 3.PROFIT!!!

Your assumption (that the network somehow runs on unicorn farts and that the need for boots-on-the-ground protection is obsolete) is fatally flawed. There's no way to outcloud everything, no matter how vigorously you try to handwave away the physical layer. Someone needs to keep the juice flowing, which also needs physical protection.

Re: CSS is powerful, you can do a lot of things without JS

#237

Earlier quoted context omitted.

Just because something can be done a certain way doesn't mean it should be done a certain way. Minimizing javascript for the sake of minimizing it is silly. People that disable javascript represent a tiny percentage of the population. No one is going to make engineering decisions based on that tiny percentage, anymore than people still target IE6.

Yeah, who cares about people using screen readers! Or search engines...

Google executes Javascript, and

>It is a common misconception that people with disabilities don't have or 'do' JavaScript, and thus, that it's acceptable to have inaccessible scripted interfaces, so long as it is accessible with JavaScript disabled. A 2012 survey by WebAIM of screen reader users found that 98.6% of respondents had JavaScript enabled.

http://webaim.org/techniques/javascript/

Re: CSS is powerful, you can do a lot of things without JS

#238
post #122

I've worked with people who did things like this. It's not fun for anyone else on the team to try and figure out why you're using specific pseudo selectors on tags in a child inside a sibling in some label to make an accordion that would take 3 lines in Javascript.

I'm interested in seeing these 3 lines of Javascript that can implement an accordion. With a sane limit to number of characters on each line as well.

https://jsfiddle.net/e77f4hhz/

Re: CSS is powerful, you can do a lot of things without JS

#239

Earlier quoted context omitted.

transition has been standardized and available in all browsers for years already, that is only necessary as fallback for very old browsers.

The only reason I use the webkit prefix on transition is for Android, otherwise I would say it isn't necessary at all.

Still a suprising number of old safari builds out in the wild, from a very quick look at our GA. Largely elderly iphones I assume?

Either way, I'm reticent to pull the WebKit prefixes from our mixins for now.

I wonder if my employers would be interested in releasing (& aggregating with other relatively large sites) our browser usage stats to create a categorised set of current 'real world' stats?

Re: CSS is powerful, you can do a lot of things without JS

#240
post #141

Earlier quoted context omitted.

CSS animations are generally on par with JavaScript, except when they're hardware accelerated. But that's changing once web animations ( https://w3c.github.io/web-animations/ ) hits mainstream anyway - both CSS & JS get access to the same engine.

The point of CSS animations isn't HW accel - you get that just from layerization. What it does get you is animations executing off the JS thread, so if you have piles of third party JS it won't cause frame drops.

Right, which you also get via the web animations API (queue up animations, and have them run on a separate thread)
Post reply on HN