feat: allow source element (#45935)

pull/46090/head
Naomi Carrigan 2022-05-13 05:52:18 -07:00 committed by GitHub
parent 0677464b68
commit cc18ce951b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 4 deletions

View File

@ -119,8 +119,16 @@ assert(!!el && (el.tagName === 'VIDEO' || el.tagName === 'IFRAME'))
Your `#video` should have a `src` attribute
```js
const el = document.getElementById('video')
assert(!!el && !!el.src)
let el = document.getElementById('video')
const sourceNode = el.children;
let sourceElement = null;
if (sourceNode.length) {
sourceElement = [...video.children].filter(el => el.localName === 'source')[0];
}
if (sourceElement) {
el = sourceElement;
}
assert(el.hasAttribute('src'));
```
You should have a `form` element with an `id` of `form`

View File

@ -119,8 +119,16 @@ assert(!!el && (el.tagName === 'VIDEO' || el.tagName === 'IFRAME'))
Your `#video` should have a `src` attribute.
```js
const el = document.getElementById('video')
assert(!!el && !!el.src)
let el = document.getElementById('video')
const sourceNode = el.children;
let sourceElement = null;
if (sourceNode.length) {
sourceElement = [...video.children].filter(el => el.localName === 'source')[0];
}
if (sourceElement) {
el = sourceElement;
}
assert(el.hasAttribute('src'));
```
You should have a `form` element with an `id` of `form`.