window.innerWidth - workaround for when it returns the wrong value
I have never seen innerWidth or innerHeight report the wrong value. There are a few bugs listed for chrome and firefox but they are all closed.
Could you provide any evidence?
UPDATE
Media query matches down to fractions of a CSS pixel while innerWidth returns integer CSS pixel values. This is a problem when devicePixelRatio !== devicePixelRatio | 0
I tried to find a cover all solution, but too much time need to complete so I withdraw the answers content.