From a8ede71d8728d8f13eed9b90faa7c7fe279f68aa Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 9 Oct 2007 21:04:26 +0000 Subject: [PATCH] Force prototype to load before jquery. Props mdawaffe. fixes #5067 for trunk git-svn-id: http://svn.automattic.com/wordpress/trunk@6209 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/script-loader.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 2a7730cc10..f8c83d0f08 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -421,4 +421,24 @@ function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false } $wp_scripts->enqueue( $handle ); } + +function wp_prototype_before_jquery( $js_array ) { + if ( false === $jquery = array_search( 'jquery', $js_array ) ) + return $js_array; + + if ( false === $prototype = array_search( 'prototype', $js_array ) ) + return $js_array; + + if ( $prototype < $jquery ) + return $js_array; + + unset($js_array[$prototype]); + + array_splice( $js_array, $jquery, 0, 'prototype' ); + + return $js_array; +} + +add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' ); + ?>