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

Validation error: Element mediaelementwrapper not allowed as child of element div in this context. #2800

Open
jenemde opened this issue Jun 19, 2020 · 4 comments

Comments

@jenemde
Copy link
Contributor

jenemde commented Jun 19, 2020

Hi, thanks for your great library.
Using the Nu Html Checker (https://validator.w3.org/nu/about.html) which does not check the source code but the generated code ("Check serialized DOM of current page") I get the error message:

Element mediaelementwrapper not allowed as child of element div in this context. (Suppressing further errors from this subtree.)

I see no possibility to avoid it - do you?
Changing the name into anything else ('me-wrapper' or even 'div') leads to the error message:

Element source not allowed as child of element video in this context. (Suppressing further errors from this subtree.)

We need a "no error validation" from the Nu Html Checker as a prerequisite for a wcag-test (https://testen.bitv-test.de/index.php?a=di&iid=99, sorry, its in German)
Thanks a lot for your help!

@jaapmarcus
Copy link
Contributor

Haven't tested yet how ever you can try to replace fakeNodeName: 'mediaelementwrapper',

With div and then build mejs again.

@jenemde
Copy link
Contributor Author

jenemde commented Jun 22, 2020

Thanks for your tip, but erplacing the fakeNodeName with 'div' leads to
Element source not allowed as child of element video in this context. (Suppressing further errors from this subtree.)
I guess this error would also be thrown without replacing fakeNodeName, but as the validator says "Suppressing further errors from this subtree."

@jaapmarcus
Copy link
Contributor

Source tag should be valid to be used in this context
https://www.w3schools.com/tags/att_video_src.asp

You can try to validate first the html code with mediaelmements disabled to check if html code is fine...

@jenemde
Copy link
Contributor Author

jenemde commented Jun 22, 2020

Yes, I see. But there is a difference in the code of MediaElement.js and the example on the page you sent me. The reason for this error:
Element source not allowed as child of element video in this context. (Suppressing further errors from this subtree.)
is the src-attribute in the <video>-tag. If there is a src-attribute, the <source>-tag is not allowed within the <video>-tag. The validator shows this message after the error message:

Contexts in which element source may be used:
As a child of a picture element, before the img element.
As a child of a media element, before any flow content or track elements.
Content model for element video:
If the element has a src attribute: zero or more track elements, then transparent, but with no media element descendants.
If the element does not have a src attribute: zero or more source elements, then zero or more track elements, then transparent, but with no media element descendants.

You can check it on https://www.mediaelementjs.com/ after replacing the <mediaelementwrapper>-tag with <div> in the DOM. This is exactly the same error I get on my page. If I remove the src-attribute from the <video>-tag in teh DOM, the error doesn't appear anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants