Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 21509)
+++ wp-includes/link-template.php	(working copy)
@@ -2095,6 +2095,31 @@
 }
 
 /**
+ * Retrieve the url of the template file.
+ *
+ * Searches in the stylesheet directory before the template directory so themes
+ * which inherit from a parent theme can just overload one file.
+ *
+ * @since 3.5.0
+ *
+ * @param string $template_names Template file to search for.
+ * @return string The URI of the file if one is located.
+ */
+function theme_url( $file = '' ) {
+	$file = ltrim( $file, '/' );
+
+	if ( empty( $file ) || ( false !== strpos( $file, '..' ) ) ) {
+		$url = get_stylesheet_directory_uri();
+	} elseif ( is_child_theme() && file_exists( trailingslashit( get_stylesheet_directory() ) . $file ) ) {
+		$url = trailingslashit( get_stylesheet_directory_uri() ) . $file;
+	} else {
+		$url = trailingslashit( get_template_directory_uri() ) . $file;
+	}
+
+	return apply_filters( 'theme_url', $url, $file );
+}
+
+/**
  * Retrieve the site url for the current network.
  *
  * Returns the site url with the appropriate protocol, 'https' if
Index: wp-content/themes/twentytwelve/header.php
===================================================================
--- wp-content/themes/twentytwelve/header.php	(revision 21509)
+++ wp-content/themes/twentytwelve/header.php	(working copy)
@@ -22,7 +22,7 @@
 <link rel="profile" href="http://gmpg.org/xfn/11" />
 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
 <!--[if lt IE 9]>
-<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
+<script src="<?php echo theme_url( 'js/html5.js' ); ?>" type="text/javascript"></script>
 <![endif]-->
 <?php wp_head(); ?>
 </head>
Index: wp-content/themes/twentytwelve/functions.php
===================================================================
--- wp-content/themes/twentytwelve/functions.php	(revision 21509)
+++ wp-content/themes/twentytwelve/functions.php	(working copy)
@@ -104,7 +104,7 @@
 	 * JavaScript for handling navigation menus and the resized
 	 * styles for small screen sizes.
 	 */
-	wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20120802', true );
+	wp_enqueue_script( 'twentytwelve-navigation', theme_url( 'js/theme.js' ), array( 'jquery' ), '20120802', true );
 
 	/**
 	 * Load special font CSS file.
Index: wp-content/themes/twentytwelve/inc/theme-options.php
===================================================================
--- wp-content/themes/twentytwelve/inc/theme-options.php	(revision 21509)
+++ wp-content/themes/twentytwelve/inc/theme-options.php	(working copy)
@@ -241,7 +241,7 @@
 	 * @return void
 	 */
 	public function customize_preview_js() {
-		wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20120802', true );
+		wp_enqueue_script( 'twentytwelve-customizer', theme_url( 'js/theme-customizer.js' ), array( 'customize-preview' ), '20120802', true );
 		wp_localize_script( 'twentytwelve-customizer', 'twentytwelve_customizer', array(
 			'option_key' => $this->option_key,
 			'link'       => $this->custom_fonts_url(),
Index: wp-content/themes/twentyeleven/showcase.php
===================================================================
--- wp-content/themes/twentyeleven/showcase.php	(revision 21509)
+++ wp-content/themes/twentyeleven/showcase.php	(working copy)
@@ -15,7 +15,7 @@
  */
 
 // Enqueue showcase script for the slider
-wp_enqueue_script( 'twentyeleven-showcase', get_template_directory_uri() . '/js/showcase.js', array( 'jquery' ), '2011-04-28' );
+wp_enqueue_script( 'twentyeleven-showcase', theme_url( 'js/showcase.js' ), array( 'jquery' ), '2011-04-28' );
 
 get_header(); ?>
 
Index: wp-content/themes/twentyeleven/header.php
===================================================================
--- wp-content/themes/twentyeleven/header.php	(revision 21509)
+++ wp-content/themes/twentyeleven/header.php	(working copy)
@@ -49,7 +49,7 @@
 <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
 <!--[if lt IE 9]>
-<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
+<script src="<?php echo theme_url( 'js/html5.js' ); ?>" type="text/javascript"></script>
 <![endif]-->
 <?php
 	/* We add some JavaScript to pages with the comment form
Index: wp-content/themes/twentyeleven/inc/theme-options.php
===================================================================
--- wp-content/themes/twentyeleven/inc/theme-options.php	(revision 21509)
+++ wp-content/themes/twentyeleven/inc/theme-options.php	(working copy)
@@ -16,8 +16,8 @@
  *
  */
 function twentyeleven_admin_enqueue_scripts( $hook_suffix ) {
-	wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' );
-	wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( 'farbtastic' ), '2011-06-10' );
+	wp_enqueue_style( 'twentyeleven-theme-options', theme_url( 'inc/theme-options.css' ), false, '2011-04-28' );
+	wp_enqueue_script( 'twentyeleven-theme-options', theme_url( 'inc/theme-options.js' ), array( 'farbtastic' ), '2011-06-10' );
 	wp_enqueue_style( 'farbtastic' );
 }
 add_action( 'admin_print_styles-appearance_page_theme_options', 'twentyeleven_admin_enqueue_scripts' );
@@ -147,13 +147,13 @@
 		'light' => array(
 			'value' => 'light',
 			'label' => __( 'Light', 'twentyeleven' ),
-			'thumbnail' => get_template_directory_uri() . '/inc/images/light.png',
+			'thumbnail' => theme_url( 'inc/images/light.png' ),
 			'default_link_color' => '#1b8be0',
 		),
 		'dark' => array(
 			'value' => 'dark',
 			'label' => __( 'Dark', 'twentyeleven' ),
-			'thumbnail' => get_template_directory_uri() . '/inc/images/dark.png',
+			'thumbnail' => theme_url( 'inc/images/dark.png' ),
 			'default_link_color' => '#e4741f',
 		),
 	);
@@ -171,17 +171,17 @@
 		'content-sidebar' => array(
 			'value' => 'content-sidebar',
 			'label' => __( 'Content on left', 'twentyeleven' ),
-			'thumbnail' => get_template_directory_uri() . '/inc/images/content-sidebar.png',
+			'thumbnail' => theme_url( 'inc/images/content-sidebar.png' ),
 		),
 		'sidebar-content' => array(
 			'value' => 'sidebar-content',
 			'label' => __( 'Content on right', 'twentyeleven' ),
-			'thumbnail' => get_template_directory_uri() . '/inc/images/sidebar-content.png',
+			'thumbnail' => theme_url( 'inc/images/sidebar-content.png' ),
 		),
 		'content' => array(
 			'value' => 'content',
 			'label' => __( 'One-column, no sidebar', 'twentyeleven' ),
-			'thumbnail' => get_template_directory_uri() . '/inc/images/content.png',
+			'thumbnail' => theme_url( 'inc/images/content.png' ),
 		),
 	);
 
@@ -362,7 +362,7 @@
 	$color_scheme = $options['color_scheme'];
 
 	if ( 'dark' == $color_scheme )
-		wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), null );
+		wp_enqueue_style( 'dark', theme_url( 'colors/dark.css' ), array(), null );
 
 	do_action( 'twentyeleven_enqueue_color_scheme', $color_scheme );
 }
@@ -526,6 +526,6 @@
  * @since Twenty Eleven 1.3
  */
 function twentyeleven_customize_preview_js() {
-	wp_enqueue_script( 'twentyeleven-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array( 'customize-preview' ), '20120523', true );
+	wp_enqueue_script( 'twentyeleven-customizer', theme_url( 'inc/theme-customizer.js' ), array( 'customize-preview' ), '20120523', true );
 }
 add_action( 'customize_preview_init', 'twentyeleven_customize_preview_js' );
\ No newline at end of file
