scottjehl / css-inapplicable-load Goto Github PK
View Code? Open in Web Editor NEWTesting for Asynchronous Load of Inapplicable CSS StyleSheets
License: MIT License
Testing for Asynchronous Load of Inapplicable CSS StyleSheets
License: MIT License
This is awesome stuff Scott. Keep it goin' on.
It might be useful to further define how browsers handle inapplicable media queries inside iframes. Presumably the parent layout has to be complete before the iframe's viewport is defined, and thus available for load decisions? This has already come up in the FF bug discussion, and it might to useful to know exactly what's happening cross-browser.
I've been looking into this on and off for the last couple of days since stumbling across the repo. One possible solution I'm testing to prevent IE8 and lower from downloading inapplicable CSS is to use the following:
<!--[if ! lte IE 8]>-->
<link rel="stylesheet" type="text/css" media="only screen and (min-width: 320px)" href="css/style.css" />
<!--<![endif]-->
<!--[if (gte IE 6)&(lte IE 8)]>
<link rel="stylesheet" type="text/css" media="all" href="css/ie.css" />
<![endif]-->
It's fairly straightforward. Tell every browser but IE8 and lower to download the media queried CSS and then load up a separate file for IE8 and lower using the reverse of the same technique we're all familiar with.
I've tested the above in IE8 using browserstack and firebug to determine what stylesheets were downloaded and it appears to work.
For all I know this is a well known solution but maybe it might help someone. It may require more definitive testing.
is an example that eagerly loads CSS but doesn't block the page rendering on IE9, IE10, IE11, recent Firefox, Chrome, Chrome Android, iOS. It works correctly on IE6, IE7, IE8 but no early loading (page is slow to render).
Same example as above with some extra xmlhttp logging to the proxy (interferes with and slows page load, but shows interesting timing information): http://jsbin.com/EPEdUXeX/4 Both are based on this experimentation page http://jsbin.com/OFeKabIY/29 (which may crash on IE8...).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.