WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#31766 closed defect (bug) (fixed)

'word-count' always enqueued, even when not needed

Reported by: johnjamesjacoby Owned by: iseulde
Milestone: 4.3 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

When tinymce is false (and subsequently when teeny is true) the word-count script is still enqueued, even though there is no relevant UI for it to report back to.

This results in WordPress enqueueing /wp-admin/js/word-count$suffix.js when it does not appear to be necessary, and also inserts an additional script tag for the accompanying wordCountL10n localized value.

Attachments (1)

31766.01.patch (476 bytes) - added by johnjamesjacoby 6 years ago.
Move the word-count enqueue into the self::$has_tinymce check

Download all attachments as: .zip

Change History (8)

@johnjamesjacoby
6 years ago

Move the word-count enqueue into the self::$has_tinymce check

#1 @johnjamesjacoby
6 years ago

  • Keywords has-patch 2nd-opinion added

#2 @johnjamesjacoby
6 years ago

For a quick way to confirm this:

Notice the script tag and included javascript file, even though no visual editor or word count UI exists

#3 @DrewAPicture
6 years ago

First of all, seems like a valid expectation that we wouldn't want to enqueue 'word-count' if there's no editor. So with that in mind, what about using dependencies to load it instead of individually enqueuing them?

#4 @iseulde
6 years ago

  • Component changed from TinyMCE to Editor
  • Focuses performance removed

#5 @iseulde
6 years ago

In [32856] this has become a dependency of post.js, so it should be removed.

#6 @iseulde
6 years ago

  • Owner set to iseulde
  • Resolution set to fixed
  • Status changed from new to closed

In 33295:

Editor: word count: remove redundant script enqueuing

It is now a dependency of post.

Part props johnjamesjacoby.
Fixes #31766. See #30966.

#7 @iseulde
6 years ago

  • Milestone changed from Awaiting Review to 4.3
Note: See TracTickets for help on using tickets.