Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add an option to suppress out of dom warning #7808

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

joeflateau
Copy link
Contributor

Description

Adds an option to suppress the "The element supplied is not included in the DOM" warning for intentionally detached video/audio elements.

Use case: video.js wrapping html5 audio element but not using video.js UI and video.js wrapping html5 video rendered into a WebGL scene.

Specific Changes proposed

add a player option that, when set to true, suppresses the warning

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chrome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
    • Example created (starter template on JSBin)
  • Reviewed by Two Core Contributors

@welcome
Copy link

welcome bot commented Jun 21, 2022

💖 Thanks for opening this pull request! 💖

Things that will help get your PR across the finish line:

  • Run npm run lint -- --errors locally to catch formatting errors earlier.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

Copy link
Member

@misteroneill misteroneill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and sorry about the delay in addressing it!

I don't have anything strongly against it, but I wonder if it's needed. Your use case makes sense, but isn't logging a warning the right thing to do?

A warning doesn't mean action needs to be taken, it means there is a condition which may deserve attention, but may also be ignorable.

@misteroneill misteroneill added the needs: discussion Needs a broader discussion label Aug 2, 2022
@joeflateau
Copy link
Contributor Author

I don't disagree that the warning should be generated by default if the element is not in the dom, but there should also be a way to suppress the warning if you have the element out of the dom on purpose. Once you start ignoring warnings because you can't suppress them then you're going to start ignoring warnings that you should actually be correcting. Perhaps instead of introducing a new option here we can instead change the logic so if there is a VIDEO element out of dom then the warning is generated but if there is an AUDIO element out of the dom then no warning is generated?

@misteroneill misteroneill force-pushed the main branch 2 times, most recently from c1898b4 to 4f8227d Compare November 23, 2022 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: discussion Needs a broader discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants