Integrate media query evaluation into HTML5 event loop