Index: src/wp-includes/class.wp-scripts.php
===================================================================
--- src/wp-includes/class.wp-scripts.php	(revision 25017)
+++ src/wp-includes/class.wp-scripts.php	(working copy)
@@ -58,11 +58,13 @@
 		return $this->print_extra_script( $handle, $echo );
 	}
 
-	function print_extra_script( $handle, $echo = true ) {
-		if ( !$output = $this->get_data( $handle, 'data' ) )
+	function print_extra_script( $handle, $echo = true, $data = 'data' ) {
+		if ( ! $output = $this->get_data( $handle, $data ) )
 			return;
 
-		if ( !$echo )
+		$output = implode( "\n", $output );
+
+		if ( ! $echo )
 			return $output;
 
 		echo "<script type='text/javascript'>\n"; // CDATA and type='text/javascript' is not needed for HTML 5
@@ -119,14 +121,30 @@
 
 		$src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
 
-		if ( $this->do_concat )
+		if ( $this->do_concat ) {
 			$this->print_html .= "<script type='text/javascript' src='$src'></script>\n";
-		else
+			$this->print_html .= $this->print_extra_script( $handle, false, 'after' );
+		} else {
 			echo "<script type='text/javascript' src='$src'></script>\n";
+			$this->print_extra_script( $handle, true, 'after' );
+		}
 
 		return true;
 	}
 
+	function add_inline_script( $handle, $code ) {
+		if ( ! $code )
+			return false;
+
+		$after = $this->get_data( $handle, 'after' );
+		if ( ! $after )
+			$after = array();
+
+		$after[] = $code;
+
+		return $this->add_data( $handle, 'after', $after );
+	}
+
 	/**
 	 * Localizes a script
 	 *
Index: src/wp-includes/functions.wp-scripts.php
===================================================================
--- src/wp-includes/functions.wp-scripts.php	(revision 25017)
+++ src/wp-includes/functions.wp-scripts.php	(working copy)
@@ -39,6 +39,32 @@
 }
 
+/**
+ * Adds extra javascript.
+ *
+ * Works only if the javascript has already been added.
+ * Accepts a string $data containing the javascript. If two or more javascript code blocks are
+ * added to the same stylesheet $handle, they will be printed in the order
+ * they were added, i.e. the latter added styles can redeclare the previous.
+ *
+ * Uses $wp_scripts
+ *
+ * @since 3.7.0
+ * @see WP_Scripts::add_inline_script()
+ * @param $handle string Handle of the script to put this inline script after
+ * @param $data string Script to put after the script of the $handle
+ */
+function wp_add_inline_script( $handle, $data ) {
+	global $wp_scripts;
+	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ), '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.7' );
+		$wp_scripts = new WP_Scripts();
+	}
+
+	return $wp_scripts->add_inline_script( $handle, $data );
+}
+
 /**
  * Register new Javascript file.
  *
  * @since r16
Index: tests/tests/dependencies/scripts.php
===================================================================
--- tests/tests/dependencies/scripts.php	(revision 25017)
+++ tests/tests/dependencies/scripts.php	(working copy)
@@ -42,6 +42,23 @@
 	}
 
+	/**
+	 * Tests wp_add_inline_scripts
+	 * @ticket 14853
+	 */
+	public function test_wp_add_inline_script() {
+		$expected = '';
+		$ver = get_bloginfo( 'version' );
+
+		wp_enqueue_script( 'handle', '//url' );
+		wp_add_inline_script( 'handle', 'sometestdata' );
+		$expected .= "<script type='text/javascript' src='//url?ver=$ver'></script>\n";
+		$expected .= "<script type='text/javascript'>\n/* <![CDATA[ */\nsometestdata\n/* ]]> */\n</script>\n";
+
+		$returned = get_echo( 'wp_print_scripts' );
+		$this->assertEquals( $expected, $returned );
+	}
+
 	/**
 	 * Test the different protocol references in wp_enqueue_script
 	 * @global WP_Scripts $wp_scripts
 	 * @ticket 16560