From 0fb24b1a07674c150bc669213fbb377cc7f1a2a7 Mon Sep 17 00:00:00 2001 From: Ryan Boren 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: https://develop.svn.wordpress.org/trunk@6209 602fd350-edb4-49c9-b593-d223f7449a82 --- 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' ); + ?>