Responsive dev best practices

Hello there,

I’m working with a client with their own dev team, which I’m trying to advise.

Their lead front-end developer tells me he’d rather use Javascript to detect the device’s size rather than use media-queries.

According to him media-queries slow down the rendering engine.

Now I’m quite good with all things CSS/HTML but that’s beyond me. It seems obvious to me that media-queries are better than some Javascript detection. Am I right? What should I say to convince them?

thanks a lot in advance for your help

PS: if you know of any resources/stats about rendering engine and performance issues with CSS, I’m interested

If you will use Javascrip, you only need CSS in setting up a configuration for a particular viewport width when downloaded while for media queries, every visitor is need to download the CSS for every width, even if they don’t need it. It also create larger CSS files.