WordPress.org

Make WordPress Core

Changeset 6210


Ignore:
Timestamp:
10/09/2007 09:04:40 PM (11 years ago)
Author:
ryan
Message:

Force prototype to load before jquery. Props mdawaffe. fixes #5067 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/wp-includes/script-loader.php

    r6133 r6210  
    422422    $wp_scripts->enqueue( $handle );
    423423}
     424
     425function wp_prototype_before_jquery( $js_array ) {
     426    if ( false === $jquery = array_search( 'jquery', $js_array ) )
     427        return $js_array;
     428
     429    if ( false === $prototype = array_search( 'prototype', $js_array ) )
     430        return $js_array;
     431
     432    if ( $prototype < $jquery )
     433        return $js_array;
     434
     435    unset($js_array[$prototype]);
     436
     437    array_splice( $js_array, $jquery, 0, 'prototype' );
     438
     439    return $js_array;
     440}
     441
     442add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
     443
    424444?>
Note: See TracChangeset for help on using the changeset viewer.