Changeset 36871
- Timestamp:
- 03/06/2016 07:49:54 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class.wp-dependencies.php
r36744 r36871 78 78 * @access public 79 79 * @since 2.8.0 80 * @deprecated 4.5.0 80 81 * @var int 81 82 */ … … 162 163 continue; 163 164 164 $moved = $this->set_group( $handle, $recursion, $group ); 165 $moved = $this->set_group( $handle, $recursion, $group ); 166 $new_group = $this->groups[ $handle ]; 165 167 166 168 if ( $queued && !$moved ) // already queued and in the right group … … 172 174 elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) ) 173 175 $keep_going = false; // Item requires dependencies that don't exist. 174 elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $ group ) )176 elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $new_group ) ) 175 177 $keep_going = false; // Item requires dependencies that don't exist. 176 178 … … 398 400 $group = (int) $group; 399 401 400 if ( $recursion ) { 401 $group = min( $this->group, $group ); 402 } 403 404 $this->group = $group; 405 406 if ( isset($this->groups[$handle]) && $this->groups[$handle] <= $group ) 407 return false; 408 409 $this->groups[$handle] = $group; 402 if ( isset( $this->groups[ $handle ] ) && $this->groups[ $handle ] <= $group ) { 403 return false; 404 } 405 406 $this->groups[ $handle ] = $group; 407 410 408 return true; 411 409 } -
trunk/src/wp-includes/class.wp-scripts.php
r36744 r36871 510 510 */ 511 511 public function all_deps( $handles, $recursion = false, $group = false ) { 512 $r = parent::all_deps( $handles, $recursion );512 $r = parent::all_deps( $handles, $recursion, $group ); 513 513 if ( ! $recursion ) { 514 514 /** -
trunk/src/wp-includes/class.wp-styles.php
r36744 r36871 311 311 */ 312 312 public function all_deps( $handles, $recursion = false, $group = false ) { 313 $r = parent::all_deps( $handles, $recursion );313 $r = parent::all_deps( $handles, $recursion, $group ); 314 314 if ( ! $recursion ) { 315 315 /** -
trunk/tests/phpunit/tests/dependencies/scripts.php
r36633 r36871 273 273 */ 274 274 function test_wp_register_script_with_dependencies_in_head_and_footer() { 275 wp_register_script( 'parent', '/parent.js', array( 'child ' ), '1', true ); // in footer276 wp_register_script( 'child ', '/child.js', array( 'grandchild' ), '1', false ); // in head277 wp_register_script( ' grandchild', '/grandchild.js', array(), '1', true ); // in footer275 wp_register_script( 'parent', '/parent.js', array( 'child-head' ), null, true ); // in footer 276 wp_register_script( 'child-head', '/child-head.js', array( 'child-footer' ), null, false ); // in head 277 wp_register_script( 'child-footer', '/child-footer.js', array(), null, true ); // in footer 278 278 279 279 wp_enqueue_script( 'parent' ); … … 282 282 $footer = get_echo( 'wp_print_footer_scripts' ); 283 283 284 $expected_header = "<script type='text/javascript' src='/grandchild.js?ver=1'></script>\n"; 285 $expected_header .= "<script type='text/javascript' src='/child.js?ver=1'></script>\n"; 286 $expected_footer = "<script type='text/javascript' src='/parent.js?ver=1'></script>\n"; 284 $expected_header = "<script type='text/javascript' src='/child-footer.js'></script>\n"; 285 $expected_header .= "<script type='text/javascript' src='/child-head.js'></script>\n"; 286 $expected_footer = "<script type='text/javascript' src='/parent.js'></script>\n"; 287 288 $this->assertEquals( $expected_header, $header ); 289 $this->assertEquals( $expected_footer, $footer ); 290 } 291 292 /** 293 * @ticket 35956 294 */ 295 function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order() { 296 wp_register_script( 'child-head', '/child-head.js', array(), null, false ); // in head 297 wp_register_script( 'child-footer', '/child-footer.js', array(), null, true ); // in footer 298 wp_register_script( 'parent', '/parent.js', array( 'child-head', 'child-footer' ), null, true ); // in footer 299 300 wp_enqueue_script( 'parent' ); 301 302 $header = get_echo( 'wp_print_head_scripts' ); 303 $footer = get_echo( 'wp_print_footer_scripts' ); 304 305 $expected_header = "<script type='text/javascript' src='/child-head.js'></script>\n"; 306 $expected_footer = "<script type='text/javascript' src='/child-footer.js'></script>\n"; 307 $expected_footer .= "<script type='text/javascript' src='/parent.js'></script>\n"; 308 309 $this->assertEquals( $expected_header, $header ); 310 $this->assertEquals( $expected_footer, $footer ); 311 } 312 313 /** 314 * @ticket 35956 315 */ 316 function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order_and_two_parent_scripts() { 317 wp_register_script( 'grandchild-head', '/grandchild-head.js', array(), null, false ); // in head 318 wp_register_script( 'child-head', '/child-head.js', array(), null, false ); // in head 319 wp_register_script( 'child-footer', '/child-footer.js', array( 'grandchild-head' ), null, true ); // in footer 320 wp_register_script( 'child2-head', '/child2-head.js', array(), null, false ); // in head 321 wp_register_script( 'child2-footer', '/child2-footer.js', array(), null, true ); // in footer 322 wp_register_script( 'parent-footer', '/parent-footer.js', array( 'child-head', 'child-footer', 'child2-head', 'child2-footer' ), null, true ); // in footer 323 wp_register_script( 'parent-header', '/parent-header.js', array( 'child-head' ), null, false ); // in head 324 325 wp_enqueue_script( 'parent-footer' ); 326 wp_enqueue_script( 'parent-header' ); 327 328 $header = get_echo( 'wp_print_head_scripts' ); 329 $footer = get_echo( 'wp_print_footer_scripts' ); 330 331 $expected_header = "<script type='text/javascript' src='/child-head.js'></script>\n"; 332 $expected_header .= "<script type='text/javascript' src='/grandchild-head.js'></script>\n"; 333 $expected_header .= "<script type='text/javascript' src='/child2-head.js'></script>\n"; 334 $expected_header .= "<script type='text/javascript' src='/parent-header.js'></script>\n"; 335 336 $expected_footer = "<script type='text/javascript' src='/child-footer.js'></script>\n"; 337 $expected_footer .= "<script type='text/javascript' src='/child2-footer.js'></script>\n"; 338 $expected_footer .= "<script type='text/javascript' src='/parent-footer.js'></script>\n"; 287 339 288 340 $this->assertEquals( $expected_header, $header ); … … 383 435 384 436 /** 385 * @ticket 14853 -2437 * @ticket 14853 386 438 */ 387 439 public function test_wp_add_inline_script_before_with_concat() {
Note: See TracChangeset
for help on using the changeset viewer.