HTML5 video tag without source?

Is there any specific behavior if I have a VIDEO HTML5 tag, but don't include the SRC attribute or SOURCE tags inside the element? Will it still be valid HTML, and if so, what should the browser (capable of HTML5) do - ignore the element or display its contents?

+2
source share
2 answers

Yes, there is a certain behavior; HTML5 tries to provide a specific behavior for any case where it can make a difference between browsers in order to reduce incompatibility even when working with invalid documents.

From my reading of spec , it looks like it has no attribute srcor source:

:
src: , - .
src: , , - .

, -, , src, source. Validator.nu W3C Validator , :

<!DOCTYPE html>
<title>Video test</title>
<video></video>

, , :

⌛ src, element child: networkState NETWORK_EMPTY ; .

HAVE_NOTHING

HAVE_NOTHING ( 0)
. . , networkState NETWORK_EMPTY HAVE_NOTHING.

:

( readyState HAVE_NOTHING, HAVE_METADATA, ), .

, , ; a div, , , , width height. :

<!DOCTYPE html>
<video width=100 height=100 
       style="border-width: 1px; border-color:black; border-style: solid; 
              background: green">
foobar
</video>

, , video. video, source, , , video:

. ; -, , - , , .

+6

, , , . , src , , , img. , , .

, -, , .

-2

Source: https://habr.com/ru/post/1625232/


All Articles