scottjehl/css-inapplicable-load — dự án mã nguồn mở — đang có 75 sao GitHub. Testing for Asynchronous Load of Inapplicable CSS StyleSheets
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Testing for Asynchronous Load of Inapplicable CSS StyleSheets
As we aim to address more diverse conditions and environments with CSS via Responsive Design, our ability to target styles to certain contexts while minimizing their impact on others becomes increasingly critical. CSS3 Media Queries are a powerful tool for specifying where certain CSS rules should and should not apply, but media queries have no affect on whether StyleSheets are actually requested, only whether they are rendered or not after they've been requested. This was tested and verified in a previous experiment, CSS Download Tests, which showed that all of the following StyleSheets will be downloaded by all modern browsers that were tested, regardless of whether their associated media types or queries apply:
Unfortunately, not only do browsers always request StyleSheets regardless of their applicability, but many browsers delay rendering (displaying the page content to the user) until those requests have returned. This presents a significant problem, as many browsers will wait as long as 30 seconds or more for a file to load, and a variety of network or server conditions could cause that to occur.
That said, some modern browsers (particularly those based on Webkit and now Blink) will actually evaluate media queries (when present) to determine the priority at which a StyleSheet should be loaded before requesting that StyleSheet. In these browsers, StyleSheets paired with media queries that are found to be inapplicable at load time will be loaded asynchronously (and possibly deferred until higher-priority requests have been made), meaning the page content will be displayed to the user immediately and regardless of whether those de-prioritized StyleSheets have finished loading or not. Webkit's behavior in this case was first documented in this post by Ilya Grigorik.
Given the increasing number of contexts we're addressing with CSS, this prioritized loading behavior is highly desirable, but it is not implemented in all modern browsers. Unfortunately, if we build our websites to favor this browser behavior today, for example by separating our styles into @media-specific files and loading them separately, we will introduce potential points of failure for users with browsers that don't behave in this way. This dilemma led me to create a previous experiment that mimicked the behavior with JavaScript, which worked fairly well but failed to perform quite as well as a native implementation.
Ideally, this behavior would be native and reliable across browsers, but we're not there today. This experiment tests which modern browsers implement this prioritized loading behavior, so we have a clearer picture of where it applies today.
Test Case Explained
The experiment includes an HTML file containing a single link element with a media attribute containing a probably-inapplicable media query value (min-width: 40000px). The link references a stylesheet that is designed to take 45 seconds to respond when it is requested. The HTML file also contains a single heading to test whether the page content is displayed while this request is pending.
To test behavior, I loaded the page in a variety of web browsers and observed the loading behavior in a fairly non-scientific manner to see how each browser behaved, as it's easy to see whether the behavior is present by simply observing page load.
The Results
The Good
Chrome 26: Renders page immediately (while request is pending)
Safari 6.0.2: Renders page immediately (while request is pending)
iOS Safari 6.1: Renders page immediately (while request is pending)
Đọc thêm về scottjehl/css-inapplicable-load ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/scottjehl/css-inapplicable-load là nguồn chính thức.
scottjehl/css-inapplicable-load có bao nhiêu sao?
scottjehl/css-inapplicable-load có 75 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/scottjehl/css-inapplicable-load. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
scottjehl/css-inapplicable-load có phải mã nguồn mở không?
Có — scottjehl/css-inapplicable-load phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/scottjehl/css-inapplicable-load.
scottjehl/css-inapplicable-load có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho scottjehl/css-inapplicable-load. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
scottjehl/css-inapplicable-load là gì?
scottjehl/css-inapplicable-load (scottjehl/css-inapplicable-load) là dự án PHP trên GitHub. Theo mô tả gốc: Testing for Asynchronous Load of Inapplicable CSS StyleSheets
Đọc đầy đủ README ở tab phía trên.
Chưa chắc css-inapplicable-load có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về css-inapplicable-load.