{{APIRef("HTML DOM")}}
The HTMLSourceElement
interface provides special properties (beyond the regular {{domxref("HTMLElement")}} object interface it also has available to it by inheritance) for manipulating {{htmlelement("source")}} elements.
Properties
Inherits properties from its parent, {{domxref("HTMLElement")}}.
- {{domxref("HTMLSourceElement.keySystem")}} {{experimental_inline}}
- Is a {{domxref("DOMString")}} describing the key system encrypting the stream.
- {{domxref("HTMLSourceElement.media")}}
- Is a {{domxref("DOMString")}} reflecting the {{ htmlattrxref("media", "source") }} HTML attribute, containing the intended type of the media resource.
- {{domxref("HTMLSourceElement.sizes")}} {{experimental_inline}}
- Is a {{domxref("DOMString")}}
- {{domxref("HTMLSourceElement.src")}}
- Is a {{domxref("DOMString")}} reflecting the {{ htmlattrxref("src", "source") }} HTML attribute, containing the URL for the media resource. The {{domxref("HTMLSourceElement.src")}} property has a meaning only when the associated {{HTMLElement("source")}} element is nested in a media element that is a {{htmlelement("video")}} or an {{htmlelement("audio")}} element. It has no meaning and is ignored when it is nested in a {{HTMLElement("picture")}} element.
- {{domxref("HTMLSourceElement.srcset")}} {{experimental_inline}}
- Is a {{domxref("DOMString")}} reflecting the {{ htmlattrxref("srcset", "source") }} HTML attribute, containing a list of candidate images, separated by a comma (
',', U+002C COMMA
). A candidate image is a URL followed by a'w'
with the width of the images, or an'x'
followed by the pixel density. - {{domxref("HTMLSourceElement.type")}}
- Is a {{domxref("DOMString")}} reflecting the {{ htmlattrxref("type", "source") }} HTML attribute, containing the type of the media resource.
Methods
No specific method; inherits methods from its parent, {{domxref("HTMLElement")}}.
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('EME', '#dom-sourcekeysystem', 'HTMLSourceElement')}} | {{Spec2('EME')}} | Added the keySystem attribute. |
{{SpecName('HTML WHATWG', "the-video-element.html#the-source-element", "HTMLSourceElement")}} | {{Spec2('HTML WHATWG')}} | No change from {{SpecName("HTML5 W3C")}}. |
{{SpecName('HTML5 W3C', "embedded-content-0.html#the-source-element", "HTMLSourceElement")}} | {{Spec2('HTML5 W3C')}} | Initial definition. |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoDesktop(1.9.1)}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
srcset attribute {{experimental_inline}} |
{{CompatUnknown}} | {{CompatGeckoDesktop(33)}} behind the dom.image.picture.enabled (preffed off) |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
sizes attribute {{experimental_inline}} |
{{CompatUnknown}} | {{CompatGeckoDesktop(33)}} behind the dom.image.picture.enabled (preffed off) |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
keySystem attribute {{experimental_inline}} |
{{CompatUnknown}} | {{CompatVersionUnknown}} behind the media.eme.enabled (preffed off) |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoMobile(1.9.1)}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
srcset attribute {{experimental_inline}} |
{{CompatUnknown}} | {{CompatGeckoMobile(33)}} behind the dom.image.picture.enabled (preffed off) |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
sizes attribute {{experimental_inline}} |
{{CompatUnknown}} | {{CompatGeckoMobile(33)}} behind the dom.image.picture.enabled (preffed off) |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
keySystem attribute {{experimental_inline}} |
{{CompatUnknown}} | {{CompatVersionUnknown}} behind the media.eme.enabled (preffed off) |
{{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
See also
- The HTML element implementing this interface: {{ HTMLElement("source") }}.
- The HTML DOM APIs of the elements that can contain a {{HTMLElement("source")}} element: {{domxref("HTMLVideoElement")}}, {{domxref("HTMLAudioElement")}}, {{domxref("HTMLPictureElement")}}.