Sha256: 8fff36000986ca2b513f0db5e2717bbaa8e8d6987291fa151c77c65cdbebd5d6

Contents?: true

Size: 1.41 KB

Versions: 50

Compression:

Stored size: 1.41 KB

Contents

/*! 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 */

window.matchMedia || (window.matchMedia = function() {
	"use strict";

	// For browsers that support matchMedium api such as IE 9 and webkit
	var styleMedia = (window.styleMedia || window.media);

	// For those that don't support matchMedium
	if (!styleMedia) {
		var style       = document.createElement('style'),
			script      = document.getElementsByTagName('script')[0],
			info        = null;

		style.type  = 'text/css';
		style.id    = 'matchmediajs-test';

		script.parentNode.insertBefore(style, script);

		// 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
		info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;

		styleMedia = {
			matchMedium: function(media) {
				var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';

				// 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
				if (style.styleSheet) {
					style.styleSheet.cssText = text;
				} else {
					style.textContent = text;
				}

				// Test if media query is true or false
				return info.width === '1px';
			}
		};
	}

	return function(media) {
		return {
			matches: styleMedia.matchMedium(media || 'all'),
			media: media || 'all'
		};
	};
}());

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
wrgem-0.0.55 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.54 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.53 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.52 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.51 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.50 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.49 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.48 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.47 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.46 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.45 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.44 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.43 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.42 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.41 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.40 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.39 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.38 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.37 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js
wrgem-0.0.35 lib/generators/wrstart/template/vendor/assets/components/picturefill/src/external/matchmedia.js