wordpress-plugin icon indicating copy to clipboard operation
wordpress-plugin copied to clipboard

Remove "dangerous" optimization:

Open rdm opened this issue 6 years ago • 0 comments

The removed code would prevent the player definition from being delivered to the page in some cases.

The intent of the removed code was to prevent redundant player definitions, but:

  1. wordpress shortcode expansion does not mean that that expansion becomes a part of the currently constructed page (and I wish I had more details about specifically why this happens, but I don't have that right now).

  2. inspecting a sample player definition suggests that if we put player definition "A" on the page, then player definition "B" on the page, then an further attempt to use player definition "A" would instead use definition "B" with this "optimization" in place.

  3. but it's actually quite rare to have multiple video players on a page (so why are we optimizing for that case?), and

  4. browsers heavily cache javascript (so this optimization should not provide much benefit even when it would help)

Basically, if there's a real issue here, it should be addressed in the player definition itself. We're already over-optimized on the browser side.

Removing this mechanism prevents the video player from failing (with an undefined error) in a [relatively] common case.

rdm avatar Feb 13 '19 16:02 rdm