refactor(packages): move media host observed attributes to subclasses#1326
Merged
refactor(packages): move media host observed attributes to subclasses#1326
Conversation
Made-with: Cursor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for vjs10-site ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
📦 Bundle Size Report🎨 @videojs/html — no changesPresets (7)
Media (8)
Players (3)
Skins (17)
UI Components (24)
Sizes are marginal over the root entry point. ⚛️ @videojs/react — no changesPresets (7)
Media (7)
Skins (14)
UI Components (19)
Sizes are marginal over the root entry point. 🧩 @videojs/core — no changesEntries (8)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (10)
📦 @videojs/spf — no changesEntries (3)
ℹ️ How to interpretAll sizes are standalone totals (minified + brotli).
Run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Remove the
MediaHostConstructortype and itsobservedAttributesconvention fromCustomMediaElement. Media-host-specific attributes (type,prefer-playback,debug) are now declared by the concrete custom element subclasses (HlsVideo,MuxVideo,MuxAudio) instead of being implicitly merged from the host constructor.This simplifies the attribute routing logic in
#define— a singlector.observedAttributes.includes(attr)check replaces the previous dual-source lookup — and makes it explicit which attributes each element observes.Implementation details
observedAttributesgetter no longer spreadsMediaHost.observedAttributes(it was always empty — no host ever defined one).Attributeslocal in#defineis removed;ctor.observedAttributesalready contains the props-derived attrs viagetAttrsFromProps.#defineare safe: theisDefinedguard prevents infinite recursion while still returning the correct attribute list from the subclass getter.Testing
Covered by existing
custom-media-elementtests.Made with Cursor
Note
Low Risk
Low risk refactor that only changes how
observedAttributesare declared/merged and how attribute-to-host-property routing is decided; behavioral risk is limited to attribute forwarding for affected custom media elements.Overview
Moves media-host-specific attribute observation out of
CustomMediaElementand into concrete elements.CustomMediaElementno longer supports aMediaHostConstructor.observedAttributesconvention; it now derivesobservedAttributesonly from the elementproperties.Attribute routing in
CustomMediaElement.#defineis simplified to a singlector.observedAttributes.includes(attr)check, andHlsVideo,MuxVideo, andMuxAudioexplicitly extendobservedAttributesto includetype,prefer-playback, anddebug.Reviewed by Cursor Bugbot for commit 8a5e07e. Bugbot is set up for automated code reviews on this repo. Configure here.