1/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */ 2 3window.matchMedia || 4 (window.matchMedia = (function () { 5 "use strict"; 6 7 // For browsers that support matchMedium api such as IE 9 and webkit 8 var styleMedia = window.styleMedia || window.media; 9 10 // For those that don't support matchMedium 11 if (!styleMedia) { 12 var style = document.createElement("style"), 13 script = document.getElementsByTagName("script")[0], 14 info = null; 15 16 style.type = "text/css"; 17 style.id = "matchmediajs-test"; 18 19 script.parentNode.insertBefore(style, script); 20 21 // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers 22 info = ("getComputedStyle" in window && window.getComputedStyle(style, null)) || style.currentStyle; 23 24 styleMedia = { 25 matchMedium: function (media) { 26 var text = "@media " + media + "{ #matchmediajs-test { width: 1px; } }"; 27 28 // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers 29 if (style.styleSheet) { 30 style.styleSheet.cssText = text; 31 } else { 32 style.textContent = text; 33 } 34 35 // Test if media query is true or false 36 return info.width === "1px"; 37 }, 38 }; 39 } 40 41 return function (media) { 42 return { 43 matches: styleMedia.matchMedium(media || "all"), 44 media: media || "all", 45 }; 46 }; 47 })());
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.