PDA

View Full Version : Javascript Style vs. CSS Style (Best Practice)



voodoov
5 Mar 2012, 10:37 PM
Hi,

In large applications, is it better to write custom css in JS file or CSS file?
Which one has better performance?

Javascript Style:

{
xtype: 'label',
html: 'Some Text',
style: {
fontWeight: 'bold',
display: 'block',
float: 'left',
margin: '2'
}
}

or

CSS Style:

{
xtype: 'label',
html: 'Some Text',
cls: 'myStyle'
}
-------------------
.myStyle {
font-weight: bold;
display: block;
float: left;
margin: 2px;
}


Thank you in advance.

skirtle
6 Mar 2012, 12:23 AM
I doubt there's a measurable performance difference. Where possible I would favour the separate CSS file approach.