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
This commit is contained in:
Ryan Boren 2007-10-09 21:04:26 +00:00
parent d260446047
commit 0fb24b1a07
1 changed files with 20 additions and 0 deletions

View File

@ -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' );
?>