#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)
Change History (8)
#2
@
10 years ago
For a quick way to confirm this:
- Login to bbpress.org
- Visit: https://bbpress.org/forums/topic/bbpress-2-5-5/
- View source of page
- Search for
wordCount
Notice the script tag and included javascript file, even though no visual editor or word count UI exists
#3
@
10 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?
Note: See
TracTickets for help on using
tickets.
Move the
word-count
enqueue into theself::$has_tinymce
check