WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#7642 closed defect (bug) (fixed)

scriptaculous-root loads the wrong mainfile and forces loading all the time all components instead of specific component

Reported by: codestyling Owned by: westi
Milestone: 2.7 Priority: high
Severity: major Version: 2.6
Component: General Keywords: javascript speed delivery time has-patch
Focuses: Cc:

Description

At file script-loader.php the following line can be found:

$scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.8.0');

It defines the Scriptaculous-root file to original one. If you only want to load effects.js you would address this using:

wp_enqueue_script('scriptaculous-effects');

But it behaves not as expected, it loads nevertheless all components like slider.js, builder.js and so on too.

Solution:
The definition of scriptaculous-root is wrong and should address the right file instead:

$scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.0');

in other words it should be .../wp-scriptaculous.js instead of .../scriptaculous.js because the original file loads by default all components and the wp- version doesn't load them (opposite behavoir introduction by mdawaffe serveral versions ago).

Attachments (1)

scriptaculous-root.diff (918 bytes) - added by vladimir_kolesnikov 5 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 westi6 years ago

  • Keywords reporter-feedback added; scripting scriptaculous bug removed
  • Milestone changed from 2.7 to 2.8
  • Priority changed from high to normal
  • Severity changed from major to normal

What exactly is the issue here.

I don't quite follow the explanation.

Can we have some example code to show the issue.

comment:2 codestyling6 years ago

I have done a more complete description at my blog: http://www.code-styling.de/english/wordpress-261-loads-too-many-scriptaculous-components
and also decribed the patch working correctly.

comment:3 codestyling5 years ago

  • Keywords javascript speed delivery time added; reporter-feedback removed
  • Milestone changed from 2.8 to 2.7
  • Priority changed from normal to high
  • Severity changed from normal to major

What's about this 3 character fix, fully described at my page (link above)?
This decreases the delivery speed of several blogs, because unwanted script files will be shipped!
Can this bug please be fixed?

comment:4 vladimir_kolesnikov5 years ago

  • Keywords has-patch added

Patch attached.

comment:5 westi5 years ago

  • Owner changed from anonymous to westi
  • Status changed from new to assigned

Ok reading in to this a bit more I know understand the issue.

By default scriptaculous brings in the other js files itself.

A while back we created wp-scriptaculous.js to remove that behaviour but it was not referenced by the script-loader so pulling in one of the modules pulled in everything.

comment:6 westi5 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [10110]) Make scriptaculous use the script-loader properly. Fixes #7642 props codestyling and vladimir_kolesnikov.

Note: See TracTickets for help on using tickets.