1.仕様
SOURCE要素は、
複数の代替ソースを
指定できます。
- source
-
複数の代替ソース (a multiple alternative source)
- 種類
-
空要素
任意のコンテンツを持つことができない要素です。
- カテゴリ
-
なし
- コンテンツモデル
-
何もない
要素のコンテンツモデルが「何もない」の場合、要素にはテキストノード (要素間の空白以外) と要素ノードが含まれていてはなりません。
- タグの省略
-
終了タグはありません。
- DOM インターフェイス
-
HTMLSourceElement
[Exposed=Window]
interface HTMLSourceElement : HTMLElement {
[HTMLConstructor] constructor();
[CEReactions] attribute USVString src;
[CEReactions] attribute DOMString type;
[CEReactions] attribute USVString srcset;
[CEReactions] attribute DOMString sizes;
[CEReactions] attribute DOMString media;
[CEReactions] attribute unsigned long width;
[CEReactions] attribute unsigned long height;
};
HTMLElement
[Exposed=Window]
interface HTMLElement : Element {
[HTMLConstructor] constructor();
// metadata attributes
[CEReactions] attribute DOMString title;
[CEReactions] attribute DOMString lang;
[CEReactions] attribute boolean translate;
[CEReactions] attribute DOMString dir;
// user interaction
[CEReactions] attribute (boolean or unrestricted double or DOMString)? hidden;
[CEReactions] attribute DOMString inert;
undefined click();
[CEReactions] attribute DOMString accessKey;
readonly attribute DOMString accessKeyLabel;
[CEReactions] attribute boolean draggable;
[CEReactions] attribute boolean spellcheck;
[CEReactions] attribute DOMString writingSuggestions;
[CEReactions] attribute DOMString autocapitalize;
[CEReactions] attribute [LegacyNullToEmptyString] DOMString innerText;
[CEReactions] attribute [LegacyNullToEmptyString] DOMString outerText;
ElementInternals attachInternals();
// The popover API
undefined showPopover();
undefined hidePopover();
boolean togglePopover(optional boolean force);
[CEReactions] attribute DOMString? popover;
};
HTMLElement includes GlobalEventHandlers;
HTMLElement includes ElementContentEditable;
HTMLElement includes HTMLOrSVGElement;
Element
[Exposed=Window]
interface Element : Node {
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
readonly attribute DOMString tagName;
[CEReactions] attribute DOMString id;
[CEReactions] attribute DOMString className;
[SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
[CEReactions, Unscopable] attribute DOMString slot;
boolean hasAttributes();
[SameObject] readonly attribute NamedNodeMap attributes;
sequence<DOMString> getAttributeNames();
DOMString? getAttribute(DOMString qualifiedName);
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] undefined setAttribute(DOMString qualifiedName, DOMString value);
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString value);
[CEReactions] undefined removeAttribute(DOMString qualifiedName);
[CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
boolean hasAttribute(DOMString qualifiedName);
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
Attr? getAttributeNode(DOMString qualifiedName);
Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
[CEReactions] Attr? setAttributeNode(Attr attr);
[CEReactions] Attr? setAttributeNodeNS(Attr attr);
[CEReactions] Attr removeAttributeNode(Attr attr);
ShadowRoot attachShadow(ShadowRootInit init);
readonly attribute ShadowRoot? shadowRoot;
Element? closest(DOMString selectors);
boolean matches(DOMString selectors);
boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches
HTMLCollection getElementsByTagName(DOMString qualifiedName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
[CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // legacy
undefined insertAdjacentText(DOMString where, DOMString data); // legacy
};
GlobalEventHandlers
interface mixin GlobalEventHandlers {
attribute EventHandler onabort;
attribute EventHandler onauxclick;
attribute EventHandler onbeforeinput;
attribute EventHandler onbeforematch;
attribute EventHandler onbeforetoggle;
attribute EventHandler onblur;
attribute EventHandler oncancel;
attribute EventHandler oncanplay;
attribute EventHandler oncanplaythrough;
attribute EventHandler onchange;
attribute EventHandler onclick;
attribute EventHandler onclose;
attribute EventHandler oncontextlost;
attribute EventHandler oncontextmenu;
attribute EventHandler oncontextrestored;
attribute EventHandler oncopy;
attribute EventHandler oncuechange;
attribute EventHandler oncut;
attribute EventHandler ondblclick;
attribute EventHandler ondrag;
attribute EventHandler ondragend;
attribute EventHandler ondragenter;
attribute EventHandler ondragleave;
attribute EventHandler ondragover;
attribute EventHandler ondragstart;
attribute EventHandler ondrop;
attribute EventHandler ondurationchange;
attribute EventHandler onemptied;
attribute EventHandler onended;
attribute OnErrorEventHandler onerror;
attribute EventHandler onfocus;
attribute EventHandler onformdata;
attribute EventHandler oninput;
attribute EventHandler oninvalid;
attribute EventHandler onkeydown;
attribute EventHandler onkeypress;
attribute EventHandler onkeyup;
attribute EventHandler onload;
attribute EventHandler onloadeddata;
attribute EventHandler onloadedmetadata;
attribute EventHandler onloadstart;
attribute EventHandler onmousedown;
[LegacyLenientThis] attribute EventHandler onmouseenter;
[LegacyLenientThis] attribute EventHandler onmouseleave;
attribute EventHandler onmousemove;
attribute EventHandler onmouseout;
attribute EventHandler onmouseover;
attribute EventHandler onmouseup;
attribute EventHandler onpaste;
attribute EventHandler onpause;
attribute EventHandler onplay;
attribute EventHandler onplaying;
attribute EventHandler onprogress;
attribute EventHandler onratechange;
attribute EventHandler onreset;
attribute EventHandler onresize;
attribute EventHandler onscroll;
attribute EventHandler onscrollend;
attribute EventHandler onsecuritypolicyviolation;
attribute EventHandler onseeked;
attribute EventHandler onseeking;
attribute EventHandler onselect;
attribute EventHandler onslotchange;
attribute EventHandler onstalled;
attribute EventHandler onsubmit;
attribute EventHandler onsuspend;
attribute EventHandler ontimeupdate;
attribute EventHandler ontoggle;
attribute EventHandler onvolumechange;
attribute EventHandler onwaiting;
attribute EventHandler onwebkitanimationend;
attribute EventHandler onwebkitanimationiteration;
attribute EventHandler onwebkitanimationstart;
attribute EventHandler onwebkittransitionend;
attribute EventHandler onwheel;
};
ElementContentEditable
interface mixin ElementContentEditable {
[CEReactions] attribute DOMString contentEditable;
[CEReactions] attribute DOMString enterKeyHint;
readonly attribute boolean isContentEditable;
[CEReactions] attribute DOMString inputMode;
};
HTMLOrSVGElement
interface mixin HTMLOrSVGElement {
[SameObject] readonly attribute DOMStringMap dataset;
attribute DOMString nonce; // intentionally no [CEReactions]
[CEReactions] attribute boolean autofocus;
[CEReactions] attribute long tabIndex;
undefined focus(optional FocusOptions options = {});
undefined blur();
};
- ARIA in HTML
-
暗黙的="
No
" ARIAロール="No
" aria-* 属性="No
"暗黙的な ARIAセマンティクスがありませんが、意味はあり、この意味は、ARIA によって提供されず、ARIA のユーザーに公開されていないロール、状態、プロパティで表現される可能性があります。
作成者は、暗黙的な ARIAセマンティクス, または HTML要素のネイティブセマンティクスを上書きしてはいけません。
記述できる aria-* 属性はありません。
- レンダリング
- 特になし
CSS を大雑把に読むと、 特に指定はされていません。既定値から、フローレイアウトに配置されたときにインラインレベルのボックス(インラインボックス)を生成すると思われます。 などになります。
- 説明
-
source
要素 は、複数の代替ソースを指定します。source
要素 は、作成者は img要素に複数の代替ソースセットを指定したり、メディア要素に複数の代替メディアリソースを指定したりできます。この要素は単独では何も表しません。<!DOCTYPE html>
<html lang=
"ja"> <head>
<meta charset=
"utf-8"> <title>source要素の例 - (Example of source element) | 離珠のHTMLでしぃ!</title>
</head>
<body>
<h1>source要素の例</h1>
<picture>
<source srcset=
"../Img/G00/demo.gif" media= "(max-width: 640px)"> <img src=
"../Img/G00/risyu.png" alt= "Sample gif"> </picture>
<p>この例の source要素は、画面の横幅で用意している画像が異なります。</p>
</body>
</html>
このサンプルへのリンクです。
(./exsource.htm) - 参照元
-
参照元
- HTML Living Standard. 4.8.2 The source element (Last Updated 27 August 2024)
- HTML 5.2 W3C 勧告. 4.7.4. The source element (W3C勧告、2017年12月14日)
- HTML 5.1 W3C 勧告. 4.7.4. The source element when used with the picture element (W3C勧告、2016年11月1日)
- HTML 5.1 W3C 勧告. 4.7.12. The source element (W3C勧告、2016年11月1日)
- HTML 5 W3C 勧告. 4.7.8 The source element (W3C勧告、2014年10月28日)
- MDN Web Docs. HTML <source>: メディアまたは画像のソース要素
- JSONデータ
-
JSON形式での、データのイメージです。
{
"source": {
"check": "2024-09-29",
"group": "Embedded",
"element": "- X EMPTY -- a multiple alternative source. (Void elements.) [None] --",
"attlist": {
"%Global;": "",
"type": "CDATA #IMPLIED -- Type of embedded resource --",
"media": "%MediaDesc; #IMPLIED -- Applicable media --",
"src": "%URI; #IMPLIED -- (in audio or video) Address of the resource --",
"srcset": "CDATA #IMPLIED -- (in picture) Images to use in different situations, e.g., high-resolution displays, small monitors, etc. --",
"sizes": "CDATA #IMPLIED -- (in picture) Image sizes for different page layouts --",
"width": "NUMBER #IMPLIED -- (in picture) Horizontal dimension --",
"height": "NUMBER #IMPLIED -- (in picture) Vertical dimension --",
},
"comment": "複数の代替ソース (a multiple alternative source)",
"point": "複数の代替ソースを指定します。",
"description": "作成者は img要素に複数の代替ソースセットを指定したり、メディア要素に複数の代替メディアリソースを指定したりできます。この要素は単独では何も表しません。",
"kind": "Void",
"categories": "None",
"used": [
"picture (source*,img)",
"%Media (source*,track*,%Flow)",
],
"contentmodel": "%Nothing",
"tag": [
"-",
"X",
],
"attributes": {
"type": "埋め込まれたリソースの種類",
"media": "対象メディア",
"src": "(in audio or video) リソースのアドレス",
"srcset": "(in picture) 高解像度ディスプレイ、小型モニターなど、さまざまな状況で使用する画像。",
"sizes": "(in picture) さまざまなページレイアウトの画像サイズ",
"width": "(in picture) 水平寸法",
"height": "(in picture) 垂直寸法",
},
"dominterface": "HTMLSourceElement",
"rendering": "None",
"reference": [
{
"title": "HTML Living Standard. 4.8.2 The source element",
"href": "https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element",
"heading": "HTML Living Standard. 4.8.2 The source element",
"sub": "Last Updated 27 August 2024",
},
{
"title": "HTML 5.2 W3C Recommendation. 4.7.4. The source element. W3C Recommendation, 14 December 2017.",
"href": "https://www.w3.org/TR/2017/REC-html52-20171214/semantics-embedded-content.html#the-source-element",
"heading": "HTML 5.2 W3C 勧告. 4.7.4. The source element",
"sub": "W3C勧告、2017年12月14日",
},
{
"title": "HTML 5.1 W3C Recommendation. 4.7.4. The source element when used with the picture element. W3C Recommendation, 1 November 2016.",
"href": "https://www.w3.org/TR/2016/REC-html51-20161101/semantics-embedded-content.html#the-source-element-when-used-with-the-picture-element",
"heading": "HTML 5.1 W3C 勧告. 4.7.4. The source element when used with the picture element",
"sub": "W3C勧告、2016年11月1日",
},
{
"title": "HTML 5.1 W3C Recommendation. 4.7.12. The source element. W3C Recommendation, 1 November 2016.",
"href": "https://www.w3.org/TR/2016/REC-html51-20161101/semantics-embedded-content.html#the-source-element",
"heading": "HTML 5.1 W3C 勧告. 4.7.12. The source element",
"sub": "W3C勧告、2016年11月1日",
},
{
"title": "HTML 5 W3C Recommendation. 4.7.8 The source element. W3C Recommendation, 28 October 2014.",
"href": "https://www.w3.org/TR/2014/REC-html5-20141028/embedded-content-0.html#the-source-element",
"heading": "HTML 5 W3C 勧告. 4.7.8 The source element",
"sub": "W3C勧告、2014年10月28日",
},
{
"title": "MDN Web Docs. HTML <source>: The Media or Image Source element.",
"href": "https://developer.mozilla.org/ja/docs/Web/HTML/Element/source",
"heading": "MDN Web Docs. HTML <source>: メディアまたは画像のソース要素",
},
],
"version": {
"first": "HTML5",
"latest": "HTML Living Standard",
},
}
}
注意: 簡易に描画する為に、各項目の後ろに
,
を付与しています。JSON の形式では、末尾の項目の後には,
は付けません。 - 最終確認日
-
2024-09-29