WordPress.org

Make WordPress Core

Changeset 6209


Ignore:
Timestamp:
10/09/07 21:04:26 (7 years ago)
Author:
ryan
Message:

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

File:
1 edited

Legend:

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

    r6133 r6209  
    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.