#26210 closed defect (bug) (fixed)
Twenty Fourteen: Load MediaElement.js when needed for Ephemera Widget
Reported by: | celloexpressions | Owned by: | lancewillett |
---|---|---|---|
Milestone: | 3.8 | Priority: | low |
Severity: | normal | Version: | 3.8 |
Component: | Bundled Theme | Keywords: | |
Focuses: | Cc: |
Description
When Mediaelements.js isn't needed for anything in post content on a given screen, it isn't loaded. But if a user features Audio and/or Video-formatted posts with the Twenty Fourteen Empemera widget, we need it (both for our styling and the functionality compatibility).
Might be a core issue (which we should fix).
Attachments (3)
Change History (12)
#2
in reply to:
↑ 1
@
11 years ago
- Keywords has-patch dev-feedback added; needs-patch removed
- Summary changed from Twenty Fourteen: Load Mediaelements.js when needed for Epemera Widget to Twenty Fourteen: Load MediaElement.js when needed for Ephemera Widget
Replying to dimadin:
you missed "Ephemera" in both places :)
I guess that's what happens when I try to make/comment on more than three tickets at the same time :)
#5
@
11 years ago
- Keywords needs-patch added; has-patch dev-feedback removed
@obenland is working on removing the widget caching, which will close this ticket and #26335.
Note: See
TracTickets for help on using
tickets.
This happens because content of the Twenty Fourteen Ephemera Widget (you missed "Ephemera" in both places :)) is stored to transient, while MediaElement.js is enqueued when shortcode callback function is called. So when widget content is served from transient, MediaElement.js isn't enqueued.
In my patch there is one possible workaround. It checks if MediaElement.js has been enqueued during loop and if was, it saves that information to transient so that on next view when widget content is served from transient it checks for that transient and enqueues MediaElement.js.
Con of this is that if MediaElement.js has been enqueued before loop it won't store transient while it might be needed in the future. This can be solved by only checking enqueuing status after loop but then MediaElement.js will always be enqueued even if not used by widget. Another con is that we'll have additional database request when MediaElement.js and object cache aren't used.
Second possible solution can be to use
has_shortcode()
on eachpost_content
during loop but that is more performance heavy (though only on empty cache) and MediaElement.js might not be used at all (overwritten by user).In all cases, this assumes that both script and styles are enqueued otherwise and that there aren't any other enqueues by user. Also, if there are other shortcodes with same behavior they wont be covered. This exposed important con of fragment caching that it enqueuing issue.
So there must be some sacrifice and I'm leaving to decision makers to choose.