News for hackers. Stuff that matters.
Re:Fix CSS by writing it in JavaScript by ttty on Tuesday November 25, 2014 @12:08PM (#8658537)
So you css will have the same structure as html.. Therefore why not putting your css in your html. Well, in this case you should put the css in the javascript module which renders the html and then the css.
Re:Fix CSS by writing it in JavaScript by Sakes on Tuesday November 25, 2014 @12:20PM (#8658586)
The example I provided above aggressively overwrites any inherited CSS properties for some component B.

Example 1:

<div class="component-a"><button></button><div class="component-b"><button></button></div></div>

Example 2:

<div class="component-b"><button></button></div>

Result:

The <button> wrapped in div.component-b for both above examples will render exactly the same, ignoring html structure.