Remove "dangerous" optimization: #76
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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).
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.
but it's actually quite rare to have multiple video players on a page (so why are we optimizing for that case?), and
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.