/*
	Picturefill - a crude polyfill for proposed behavior of the picture element, which does not yet exist, but should. :)
	* Author: Scott Jehl, 2012
	* License: MIT/GPLv2
	* Notes: 
	  * For active discussion of the picture element, see http://www.w3.org/community/respimg/
	  * While this code does work, it is intended to be used only for example purposes until either:
		A) A W3C Candidate Recommendation for <picture> is released
		B) A major browser implements <picture>
*/ 
(function( w ){
	
	// requires media query supporting browser with matchMedia support (polyfill available)
	if( !w.matchMedia || !w.matchMedia( "only all" ) ){
		return;
	}
	
	w.picturefill = function(){
		var ps = w.document.getElementsByTagName( "picture" );
		
		// Loop the pictures
		for( var i = 0, il = ps.length; i < il; i++ ){
			var sources = ps[ i ].getElementsByTagName( "source" ),
				matches = [];
				
			// See if which sources match	
			for( var j = 0, jl = sources.length; j < jl; j++ ){
				var media = sources[ j ].getAttribute( "media" );
				if( !media || w.matchMedia( media ).matches ){
					matches.push( sources[ j ] );
				}
			}

			// Set fallback img element src from that of last matching source element
			if( matches.length ){
				ps[ i ].getElementsByTagName( "img" )[ 0 ].src =  matches.pop().getAttribute( "src" );
			}
		}
	}
	
	// Run on resize
	if( w.addEventListener ){
		w.addEventListener( "resize", picturefill, false );
	}
	
	// Run when DOM is ready
	picturefill();
	
})( this );

@@ -495,106 +495,1197 @@
 )%7B%0A%09
-%0A%09// requires media query supporting browser with matchMedia support (polyfill available)%0A%09if( !w.
+var document = w.document,%0A%09%09Modernizr = w.Modernizr;%0A%09%0A%09// Test if %60%3Cpicture%3E%60 is supported natively. Store the boolean result for%0A%09// later use.%0A%09var hasNativePicture = !!(%0A%09%09document.createElement('picture') && window.HTMLPictureElement%0A%09);%0A%09%0A%09// Register a Modernizr test for %60%3Cpicture%3E%60, if Modernizr is present.%0A%09// Modernizr is NOT required -- this just augments it if present.%0A%09// %0A%09// If you have support for Modernizr classes in your build, this will also%0A%09// give you a handy %60.picture%60 or %60.no-picture%60 class on the %60html%60 element.%0A%09if (Modernizr) Modernizr.addTest('picture', function () %7B%0A%09%09return hasNativePicture;%0A%09%7D);%0A%09%0A%09// Exit early if %60%3Cpicture%3E%60 is natively supported.%0A%09if (hasNativePicture) return;%0A%09%0A%09var matchMedia = w.matchMedia;%0A%0A%09// A wrapper for %60window.matchMedia%60 that gives us a consistent interface%0A%09// whether we are using %60Modernizr.mq%60 or %60matchMedia%60.%0A%09var mqWrapper = function (query) %7B%0A%09%09return matchMedia(query).matches;%0A%09%7D;%0A%09%0A%09// Pick a media query function. If Modernizr is installed with the media%0A%09// query extension, use it; otherwise, use %60window.matchMedia%60 wrapper%0A%09// defined above.%0A%09var mq = Modernizr && Modernizr.mq ?%0A%09%09Modernizr.mq :%0A%09%09(
 matc
@@ -1695,14 +1695,11 @@
 dia 
-%7C%7C !w.
+&& 
 matc
@@ -1723,23 +1723,218 @@
 %22 ) 
-)%7B%0A%09%09return;%0A%09%7D
+? mqWrapper : null);%0A%09%0A%09// Exit early if:%0A%09//%0A%09// * Browser supports %60%3Cpicture%3E%60%0A%09// * Browser does not support either %60%3Cpicture%3E%60,%0A%09//   or Media Queries, or Modernizr-shimmed media queries.%0A%09if( !mq ) return;
 %0A%09%0A%09
@@ -1972,18 +1972,16 @@
 ar ps = 
-w.
 document
@@ -2334,28 +2334,18 @@
 edia %7C%7C 
-w.matchMedia
+mq
 ( media 
@@ -2345,24 +2345,16 @@
  media )
-.matches
  )%7B%0A%09%09%09%09
@@ -2600,16 +2600,17 @@
 %7D%0A%09%09%7D%0A%09%7D
+;
 %0A%09%0A%09// R
@@ -2763,9 +2763,8 @@
  this );
-%0A

Exit early if picture is natively supported (totally hypothetical at this point). If Modernizr is available, add a test for picture to it (adds handy picture/no-picture classes to HTML element). Also uses Modernizr's mq shim if available. Both these enhancements do NOT REQUIRE Modernizr and take just a few lines to implement.