Index: class.wp-scripts.php
===================================================================
--- class.wp-scripts.php	(revision 35735)
+++ class.wp-scripts.php	(working copy)
@@ -83,6 +83,15 @@
 	 * @return bool|string|void
 	 */
 	public function print_extra_script( $handle, $echo = true ) {
+		$scripts = $this->get_data( $handle, 'after' );
+		if($scripts){
+			foreach($scripts as $script){
+				echo "<script type='text/javascript'>\n"; // CDATA and type='text/javascript' is not needed for HTML 5
+					echo "$script\n";
+				echo "</script>\n";	
+			}	
+		}		
+
 		if ( !$output = $this->get_data( $handle, 'data' ) )
 			return;
 
@@ -203,6 +212,21 @@
 		return true;
 	}
 
+	public 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, only if the script has already been added
 	 *
Index: functions.wp-scripts.php
===================================================================
--- functions.wp-scripts.php	(revision 35735)
+++ functions.wp-scripts.php	(working copy)
@@ -86,6 +86,33 @@
 }
 
 /**
+ * Add extra code to a registered Script.
+ *
+ * Code will only be added if the script in already in the queue.
+ * Accepts a string $data containing the Code. If two or more code blocks
+ * are added to the same script $handle, they will be printed in the order
+ * they were added, i.e. the latter added code can redeclare the previous.
+ *
+ */
+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.3' );
+		$wp_scripts = new WP_Scripts();
+	}
+
+	if ( false !== stripos( $data, '</script>' ) ) {
+		_doing_it_wrong( __FUNCTION__, __( 'Do not pass script tags to wp_add_inline_script().' ), '4.1.3' );
+		$data = trim( preg_replace( '#<script[^>]*>(.*)</script>#is', '$1', $data ) );
+	}
+
+	return $wp_scripts->add_inline_script( $handle, $data );
+}
+
+
+/**
  * Register a new script.
  *
  * Registers a script to be linked later using the wp_enqueue_script() function.
