Skip to content

Commit

Permalink
Force prototype to load before jquery. Props mdawaffe. fixes #5067 fo…
Browse files Browse the repository at this point in the history
…r trunk

git-svn-id: http://svn.automattic.com/wordpress/branches/2.3@6210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
ryan committed Oct 9, 2007
1 parent 521ee8a commit 8422931
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions wp-includes/script-loader.php
Expand Up @@ -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' );

?>

0 comments on commit 8422931

Please sign in to comment.