WordPress.org

Make WordPress Core

Ticket #5067: 5067.diff

File 5067.diff, 745 bytes (added by mdawaffe, 11 years ago)
  • wp-includes/script-loader.php

     
    421421        }
    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?>