When it comes to adding multiple css styles to a dom element and ensuring compatibility across different browsers, which approach is more optimal for performance?
- Combining all prefixed css properties together, allowing the browser to decide which one to use:
domElement.style.cssText = "-webkit-transform: scaleY(1.25); transform: scaleY(1.25)";
- Adding css dynamically based on the specific browser or platform:
if(platform == "Chrome"){ domElement.style.cssText = "-webkit-transform: scaleY(1.25); } else { domElement.style.cssText = "transform: scaleY(1.25); }