Live data from Hacker News

No more CSS and HTML, just JS

ojjs.org

61–70 of 191 posts

Re: No more CSS and HTML, just JS

#61

So, how well does this framework handle screen readers, like JAWS? All javascript, all the time is terrible from an accessibility standpoint.

My understanding is that screen readers read from the DOM and update their buffer regularly, so as long as you're doing your rendering via the DOM, and not by drawing to a canvas or something weird like that, it won't really matter.

There's actually a lot of weirdness with certain bits of DOM events and screenreaders, with some portions updating more often than others. You'll run into situations where some updates will fire, and others won't unless your careful, and use ARIA tagging properly.

Re: No more CSS and HTML, just JS

#62
This post is getting a lot of flack from people who haven't given it more than a glance.

-------Benefits

1. SEO is not a problem.

Since OJ can be compiled on the server-side, it's comparable to EjS, JADE or other templating languages, which means SEO is not a problem.

2. Current code-size can be ignored in the long run.

This code doesn't have to be sent to the client (since it can run on the server), could possibly be hosted by a CDN and cached across the web, and can probably be tightened up in the future.

3. CSS is still available, but the views know about their css files and are coupled with them

4. True MVC on the front end

OJ gives us the chance to do true MVC in the web frontend, without having a javascript view and an dom view and css styles that are separate, but that work together to make one thing. It seems to me that they're really made for each other - shouldn't they be together at last?

5. Sharing code will be easier

OJ could eventually be supported by a package manager that allows you to include (or install for server-side) js objects for things like youtube videos, but also for tweets etc. Separation of concerns (So your app doesn't just have one huge CSS file, but each view has it's own css, and it's own html & js etc) will also reduce complexity in larger apps.

------Trade offs

1. Yet another framework to learn/use

2. May be slower than what you currently do to render pages

3. If used client side, you may weaken your site's SEO

4. New engineers to your team will likely need to be brought up to speed.

5. (short term) There are likely weird bugs you'll pull your hair out over.

Re: No more CSS and HTML, just JS

#63

What problem is ojjs solving and what are the trade-offs? For me personally, the design principle of "separation of concerns" has always worked well, especially in a team environment. Having a pure designer (on photoshop or illustrator), then an html/css expert for coding pages and finally a programmer for adding dynamic content works out as a nice pipeline for web development. With ojjs, the programmer and html/css…

The solution is very similar to GWT, Google's ugly step child. Why ugly, because it uses Java... hiss! Boo! Yet it does make every optimization under the sun and boils it down to JS. Using JS to insert CSS, DOM nodes, and more JS is becoming pretty standard now. ExtJS and GWT led the way seven years ago, and frameworks need only dumb it down more to gain popular acceptance. I've been on teams that made award winning…

Have you ever used ExtJS? ...I have had the displeasure of developing with it at a large financial institution...it is madness...everything is a JSON object and what ends up happening is a mixing of concerns...putting logic, and layout in the same place.

ExtJS didn't lead shit...there is a reason hardly anyone uses it.

GWT I am not personally familiar with, but if it is at all like ExtJS I want to stay AWAY as much as possible.

Re: No more CSS and HTML, just JS

#64
I started working on something similar to this, and left it as another object to gather dust on my SSD after it proved like a very inelegant way of making web apps/sites. Dunno, might have just been doing it wrong, but OJ seems very similar. Blog post on it here: http://www.spectrumcoding.com/projects/xalt/2013/06/27/xalt.... and repo here: https://github.com/Mirceam94/xalt

Re: No more CSS and HTML, just JS

#65
Please do not use something like this if you're building your next project. NOTHING is wrong with using mustache or so for templating, but this is just plain wrong.

You will know how much it costs to use something like this if you have a project that you've worked on for weeks or months and need to hand it over to another developer. Or actually any other interaction with a third party like a designer or frontender that's used to just juggling around some tags for preference or layout optimisation.

Re: No more CSS and HTML, just JS

#66

Love the concept, but the site itself (which I assume was built using the framework) is visibly laggy (in Chrome, on a MacBook Pro) - I'd be worried about using this for anything where performance was important, and for mobile (esp Android), it would probably be too slow to use. :-(

The next two big pushes are performance and Express (server-side) support. From my own testing OJ compiling, rendering, and DOM manipulation are actually pretty fast. As for the perf issues I am seeing (especially on mobile) I think they are at least partially caused by creating 40+ AceEditors with syntax highlighting and dynamically loading iframes like YouTube videos and TwitterButtons.

That said, lay all the perf blame on me! I can promise it will get better -- though in my defense this is the first release after all. Literally no one had heard of OJ until yesterday=).

Re: No more CSS and HTML, just JS

#67
post #31

What problem is ojjs solving and what are the trade-offs? For me personally, the design principle of "separation of concerns" has always worked well, especially in a team environment. Having a pure designer (on photoshop or illustrator), then an html/css expert for coding pages and finally a programmer for adding dynamic content works out as a nice pipeline for web development. With ojjs, the programmer and html/css…

That level of separation exists in dream worlds. Have you ever seen a job application for an "HTML/CSS Expert"...

eh... YES

Re: No more CSS and HTML, just JS

#68
There's a javascript wrapper around all html and css functionality so instead of creating a .html file you create a .js file and have javascript functions like h1('HTML Creation') instead of html like HTML Creation. Is that right?

Interesting. But why would we use this? Or is it just for fun?

Re: No more CSS and HTML, just JS

#69

Earlier quoted context omitted.

Author here=). OJ is trying to solve the View layer by creating objects that act like website building blocks. So you can insert a YouTubeVideo or a TwitterButton as easily as you add an img or a div. Check out the plugins: http://ojjs.org/plugins.html But to your question should all CSS be in JS? I'd say no, that wouldn't make sense. Clearly site level CSS should remain in a file and can be just included in a link t…

This approach creates multiple sources of truth for how elements should look, and in general I would avoid it - in the same way that I avoid using the style attribute or tags. For structure (the meaning and content of each element), use HTML. For presentation (e.g. colors, fonts, transition appearance), stick to your linked stylesheet. If you need to modify behavior (e.g. what happens on a given event), do that in a…

It really depends where you're coming from. For the kind of sites that prevailed maybe five years ago, you could separate HTML and CSS quite neatly and JS was a minor element used to add some effects. But these days you're starting to get web apps etc. with very rich interactivity; and once you're past a certain level of complexity it's inevitable that you'll end up modifying lots of HTML and CSS from JS. So if you reach that point then you can efficiently make JS your main (or even only) source of truth.
Post reply on HN