차례
      1. 4.11.5 커맨드
        1. 4.11.5.1 a 요소로 커맨드 정의
        2. 4.11.5.2 button 요소로 커맨드 정의
        3. 4.11.5.3 input 요소로 커맨드 정의
        4. 4.11.5.4 option 요소로 커맨드 정의
        5. 4.11.5.5 command 요소로 커맨드 정의
        6. 4.11.5.6 label 요소의 accesskey속성으로 커맨드 정의
        7. 4.11.5.7 legend 요소의 accesskey 속성으로 커맨드 정의
        8. 4.11.5.8 다른 요소의 accesskey 속성으로 커맨드 정의

4.11.5 커맨드

커맨드란 메뉴 아이템, 버튼, 링크의 이면에 추상화되어 있는 것입니다.

A command is the abstraction behind menu items, buttons, and links.

커맨드들은 다음과 같은 양상을 갖는 것으로 정의됩니다 :

Commands are defined to have the following facets:

Type

커맨드의 종류: "command", 일반적인 커맨드를 의미합니다. "radio", 이 커맨드를 발생시킴으로서 다른 것들 중에서도, Checked 상태를 참으로 바꾸는(그리고, 보통, 다른 커맨드들의 체크를 해제하는) 것을 의미합니다. "checkbox", 이 커맨드를 발생시킴으로서, 다른 것들 중에서도, checked 상태의 값을 토글하는 것을 의미합니다.

The kind of command: "command", meaning it is a normal command; "radio", meaning that triggering the command will, amongst other things, set the Checked State to true (and probably uncheck some other commands); or "checkbox", meaning that triggering the command will, amongst other things, toggle the value of the Checked State.

ID

커맨드의 이름입니다. 이것을 가지고 마크업이나 스크립트에서 커맨드를 참조합니다. ID를 갖지 않는 커맨드는 익명anonymous 커맨드입니니다.

The name of the command, for referring to the command from the markup or from script. If a command has no ID, it is an anonymous command.

Label

사용자에게 보여지는 커맨드의 이름입니다.

The name of the command as seen by the user.

Hint

사용자에게 보여질 수 있는, 도움이 되거나 설명적인 문자열입니다.

A helpful or descriptive string that can be shown to the user.

Icon

액션을 나타내는 그래픽 이미지를 식별하는 절대 URL입니다. 커맨드는 아이콘을 갖지 않을 수 있습니다.

An absolute URL identifying a graphical image that represents the action. A command might not have an Icon.

Access Key

커맨드를 발생시키기 위해 사용자 에이전트가 선택하는 키 조합입니다. 커맨드는 억세스키를 갖지 않을 수 있습니다.

A key combination selected by the user agent that triggers the command. A command might not have an Access Key.

Hidden State

커맨드가 보여질지, 아닐지를 나타냅니다(기본적으로, 메뉴 내에서 보일지 아닐지).

Whether the command is hidden or not (basically, whether it should be shown in menus).

Disabled State

커맨드가 관계가 있는지/아닌지, 실행될수 있는지/아닌지를 나타냅니다.

Whether the command is relevant and can be triggered or not.

Checked State

커맨드가 체크되어있는지/아닌지를 나타냅니다.

Whether the command is checked or not.

Action

커맨드를 실행하는 것이 실제로 가질 효과입니다. 스크립트된 이벤트 핸들러일 수 있고, 탐색할 URL 일 수 있으며, 폼 제출일수도 있습니다.

The actual effect that triggering the command will have. This could be a scripted event handler, a URL to which to navigate, or a form submission.

이러한 양상들은 command API 를 통해 요소에 노출됩니다.

These facets are exposed on elements using the command API:

element . commandType

type 양상을 커맨드에 노출시킵니다.

Exposes the Type facet of the command.

element . id

ID 양상을 커맨드에 노출시킵니다.

Exposes the ID facet of the command.

element . label

Label 양상을 커맨드에 노출시킵니다.

Exposes the Label facet of the command.

element . title

Hint 양상을 커맨드에 노출시킵니다.

Exposes the Hint facet of the command.

element . icon

Icon 양상을 커맨드에 노출시킵니다.

Exposes the Icon facet of the command.

element . accessKeyLabel

Access Key 양상을 커맨드에 노출시킵니다.

Exposes the Access Key facet of the command.

element . hidden

Hidden State 속성을 커맨드에 노출시킵니다. 그러한 속성은 보통 커맨드의 hidden state 양상과 동일합니다. label과 legend 요소에서(accesskey 속성과 함께 사용되었을 때), hidden state 양상은 다른 요소(할당된 억세스키가 활성화시킬)에서 가져오게 되며, 그 요소를 통해 직접적으로 접근될수는 없습니다.

Exposes the state of the element's hidden attribute, which is generally equivalent to the Hidden State facet of the command. For label and legend elements (used in conjunction with the accesskey attribute), the Hidden State facet is derived from another element (the one that the assigned access key will trigger), and cannot be directly accessed from the element.

element . disabled

Disabled State 양상을 커맨드에 노출시킵니다.

Exposes the Disabled State facet of the command.

element . checked

Checked State 양상을 커맨드에 노출시킵니다.

Exposes the Checked State facet of the command.

element . click()

커맨드의 액션을 발생시킵니다.

Triggers the Action of the command.

The commandType attribute must return a string whose value is either "command", "radio", or "checkbox", depending on whether the Type of the command defined by the element is "command", "radio", or "checkbox" respectively. If the element does not define a command, it must return null.

The label attribute must return the command's Label, or null if the element does not define a command or does not specify a Label. This attribute will be shadowed by the label IDL attribute on various elements.

The icon attribute must return the absolute URL of the command's Icon. If the element does not specify an icon, or if the element does not define a command, then the attribute must return null. This attribute will be shadowed by the icon IDL attribute on command elements.

The disabled attribute must return true if the command's Disabled State is that the command is disabled, and false if the command is not disabled. This attribute is not affected by the command's Hidden State. If the element does not define a command, the attribute must return false. This attribute will be shadowed by the disabled IDL attribute on various elements.

The checked attribute must return true if the command's Checked State is that the command is checked, and false if it is that the command is not checked. If the element does not define a command, the attribute must return false. This attribute will be shadowed by the checked IDL attribute on input and command elements.

The ID facet is exposed by the id IDL attribute, the Hint facet is exposed by the title IDL attribute, the AccessKey facet is exposed by the accessKeyLabel IDL attribute, and the Hidden State facet is exposed by the hidden IDL attribute.


document . commands

Document 에 있는, 커맨드를 정의하고 ID를 갖고 있는 요소들의 HTMLCollection을 반환합니다.

Returns an HTMLCollection of the elements in the Document that define commands and have IDs.

The commands attribute of the document's HTMLDocument interface must return an HTMLCollection rooted at the Document node, whose filter matches only elements that define commands and have IDs.


사용자 에이전트는 Hidden State 양상이 false인(보여지는) 커맨드들을 노출할 수 있습니다 - 예를 들어 사용자 에이전트의 메뉴 바에. 특히 커맨드가 억세스키를 가지고 있다면, 그러한 키를 사용자가 쉽게 알 수 있도록, 그러한 노출을 권합니다.

User agents may expose the commands whose Hidden State facet is false (visible), e.g. in the user agent's menu bar. User agents are encouraged to do this especially for commands that have Access Keys, as a way to advertise those keys to the user.

4.11.5.1 a 요소로 커맨드 정의

An a element with an href attribute defines a command.

The Type of the command is "command".

The ID of the command is the value of the id attribute of the element, if the attribute is present and not empty. Otherwise the command is an anonymous command.

The Label of the command is the string given by the element's textContent IDL attribute.

The Hint of the command is the value of the title attribute of the element. If the attribute is not present, the Hint is the empty string.

The Icon of the command is the absolute URL obtained from resolving the value of the src attribute of the first img element descendant of the element, relative to that element, if there is such an element and resolving its attribute is successful. Otherwise, there is no Icon for the command.

The AccessKey of the command is the element's assigned access key, if any.

The Hidden State of the command is true (hidden) if the element has a hidden attribute, and false otherwise.

The Disabled State facet of the command is always false. (The command is always enabled.)

The Checked State of the command is always false. (The command is never checked.)

The Action of the command is to fire a click event at the element.

4.11.5.2 button 요소로 커맨드 정의

A button element always defines a command.

The Type, ID, Label, Hint, Icon, Access Key, Hidden State, Checked State, and Action facets of the command are determined as for a elements (see the previous section).

The Disabled State of the command mirrors the disabled state of the button.

4.11.5.3 input 요소로 커맨드 정의

An input element whose type attribute is in one of the Submit Button, Reset Button, Image Button, Button, Radio Button, or Checkbox states defines a command.

The Type of the command is "radio" if the type attribute is in the Radio Button state, "checkbox" if the type attribute is in the Checkbox state, and "command" otherwise.

The ID of the command is the value of the id attribute of the element, if the attribute is present and not empty. Otherwise the command is an anonymous command.

The Label of the command depends on the Type of the command:

If the Type is "command", then it is the string given by the value attribute, if any, and a UA-dependent, locale-dependent value that the UA uses to label the button itself if the attribute is absent.

Otherwise, the Type is "radio" or "checkbox". If the element is a labeled control, the textContent of the first label element in tree order whose labeled control is the element in question is the Label (in DOM terms, this is the string given by element.labels[0].textContent). Otherwise, the value of the value attribute, if present, is the Label. Otherwise, the Label is the empty string.

The Hint of the command is the value of the title attribute of the input element. If the attribute is not present, the Hint is the empty string.

If the element's type attribute is in the Image Button state, and the element has a src attribute, and that attribute's value can be successfully resolved relative to the element, then the Icon of the command is the absolute URL obtained from resolving that attribute that way. Otherwise, there is no Icon for the command.

The AccessKey of the command is the element's assigned access key, if any.

The Hidden State of the command is true (hidden) if the element has a hidden attribute, and false otherwise.

The Disabled State of the command mirrors the disabled state of the control.

The Checked State of the command is true if the command is of Type "radio" or "checkbox" and the element is checked attribute, and false otherwise.

The Action of the command, if the element has a defined activation behavior, is to run synthetic click activation steps on the element. Otherwise, it is just to fire a click event at the element.

4.11.5.4 button 요소로 커맨드 정의

An option element with an ancestor select element and either no value attribute or a value attribute that is not the empty string defines a command.

The Type of the command is "radio" if the option's nearest ancestor select element has no multiple attribute, and "checkbox" if it does.

The ID of the command is the value of the id attribute of the element, if the attribute is present and not empty. Otherwise the command is an anonymous command.

The Label of the command is the value of the option element's label attribute, if there is one, or the value of the option element's textContent IDL attribute if there isn't.

The Hint of the command is the string given by the element's title attribute, if any, and the empty string if the attribute is absent.

There is no Icon for the command.

The AccessKey of the command is the element's assigned access key, if any.

The Hidden State of the command is true (hidden) if the element has a hidden attribute, and false otherwise.

The Disabled State of the command is true (disabled) if the element is disabled or if its nearest ancestor select element is disabled, and false otherwise.

The Checked State of the command is true (checked) if the element's selectedness is true, and false otherwise.

The Action of the command depends on its Type. If the command is of Type "radio" then it must pick the option element. Otherwise, it must toggle the option element.

4.11.5.5 command 요소로 커맨드 정의

A command element defines a command.

The Type of the command is "radio" if the command's type attribute is "radio", "checkbox" if the attribute's value is "checkbox", and "command" otherwise.

The ID of the command is the value of the id attribute of the element, if the attribute is present and not empty. Otherwise the command is an anonymous command.

The Label of the command is the value of the element's label attribute, if there is one, or the empty string if it doesn't.

The Hint of the command is the string given by the element's title attribute, if any, and the empty string if the attribute is absent.

The Icon for the command is the absolute URL obtained from resolving the value of the element's icon attribute, relative to the element, if it has such an attribute and resolving it is successful. Otherwise, there is no Icon for the command.

The AccessKey of the command is the element's assigned access key, if any.

The Hidden State of the command is true (hidden) if the element has a hidden attribute, and false otherwise.

The Disabled State of the command is true (disabled) if the element has a disabled attribute, and false otherwise.

The Checked State of the command is true (checked) if the element has a checked attribute, and false otherwise.

The Action of the command, if the element has a defined activation behavior, is to run synthetic click activation steps on the element. Otherwise, it is just to fire a click event at the element.

4.11.5.6 label 요소의 accesskey속성으로 커맨드 정의

A label element that has an assigned access key and a labeled control and whose labeled control defines a command, itself defines a command.

The Type of the command is "command".

The ID of the command is the value of the id attribute of the element, if the attribute is present and not empty. Otherwise the command is an anonymous command.

The Label of the command is the string given by the element's textContent IDL attribute.

The Hint of the command is the value of the title attribute of the element.

There is no Icon for the command.

The AccessKey of the command is the element's assigned access key.

The Hidden State, Disabled State, and Action facets of the command are the same as the respective facets of the element's labeled control.

The Checked State of the command is always false. (The command is never checked.)

4.11.5.7 legend 요소의 accesskey 속성으로 커맨드 정의

A legend element that has an assigned access key and is a child of a fieldset element that has a descendant that is not a descendant of the legend element and is neither a label element nor a legend element but that defines a command, itself defines a command.

The Type of the command is "command".

The ID of the command is the value of the id attribute of the element, if the attribute is present and not empty. Otherwise the command is an anonymous command.

The Label of the command is the string given by the element's textContent IDL attribute.

The Hint of the command is the value of the title attribute of the element.

There is no Icon for the command.

The AccessKey of the command is the element's assigned access key.

The Hidden State, Disabled State, and Action facets of the command are the same as the respective facets of the first element in tree order that is a descendant of the parent of the legend element that defines a command but is not a descendant of the legend element and is neither a label nor a legend element.

The Checked State of the command is always false. (The command is never checked.)

4.11.5.8 다른 요소의 accesskey 속성으로 커맨드 정의

An element that has an assigned access key defines a command.

If one of the other sections that define elements that define commands define that this element defines a command, then that section applies to this element, and this section does not. Otherwise, this section applies to that element.

The Type of the command is "command".

The ID of the command is the value of the id attribute of the element, if the attribute is present and not empty. Otherwise the command is an anonymous command.

The Label of the command depends on the element. If the element is a labeled control, the textContent of the first label element in tree order whose labeled control is the element in question is the Label (in DOM terms, this is the string given by element.labels[0].textContent). Otherwise, the Label is the textContent of the element itself.

The Hint of the command is the value of the title attribute of the element. If the attribute is not present, the Hint is the empty string.

There is no Icon for the command.

The AccessKey of the command is the element's assigned access key.

The Hidden State of the command is true (hidden) if the element has a hidden attribute, and false otherwise.

The Disabled State facet of the command is always false. (The command is always enabled.)

The Checked State of the command is always false. (The command is never checked.)

The Action of the command is to run the following steps:

  1. If the element is focusable, run the focusing steps for the element.
  2. If the element has a defined activation behavior, run synthetic click activation steps on the element.
  3. Otherwise, if the element does not have a defined activation behavior, fire a click event at the element.