diff options
| author | Florian Merz <me@fiji-flo.de> | 2021-02-23 15:56:25 +0100 |
|---|---|---|
| committer | Florian Merz <me@fiji-flo.de> | 2021-02-23 15:56:25 +0100 |
| commit | 05b2650717b84d199f6ebd5df8a8f9d1e3b23f3f (patch) | |
| tree | 3a996b21e1eb1ed852ab792b9752648783a87a75 /files/ko/web/api/documentorshadowroot | |
| parent | 10701ffef1cb57f06970990b9b7086ea7f24a019 (diff) | |
| download | translated-content-05b2650717b84d199f6ebd5df8a8f9d1e3b23f3f.tar.gz translated-content-05b2650717b84d199f6ebd5df8a8f9d1e3b23f3f.tar.bz2 translated-content-05b2650717b84d199f6ebd5df8a8f9d1e3b23f3f.zip | |
sync: move
Diffstat (limited to 'files/ko/web/api/documentorshadowroot')
| -rw-r--r-- | files/ko/web/api/documentorshadowroot/activeelement/index.html | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/files/ko/web/api/documentorshadowroot/activeelement/index.html b/files/ko/web/api/documentorshadowroot/activeelement/index.html deleted file mode 100644 index 2f4d4394d9..0000000000 --- a/files/ko/web/api/documentorshadowroot/activeelement/index.html +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: DocumentOrShadowRoot.activeElement -slug: Web/API/DocumentOrShadowRoot/activeElement -tags: - - API - - Document - - DocumentOrShadowRoot - - Focus - - Property - - Reference - - ShadowRoot -translation_of: Web/API/DocumentOrShadowRoot/activeElement ---- -<div>{{APIRef("Shadow DOM")}}</div> - -<p><span class="seoSummary">{{domxref("Document")}}와 {{domxref("ShadowRoot")}} 인터페이스의 <strong><code>activeElement</code></strong> 읽기 전용 속성은 DOM과 섀도우 DOM 내에서 현재 포커스를 받은 {{domxref("Element")}} 객체를 반환합니다.</span> 이 속성은 {{domxref("DocumentOrShadowRoot")}} {{Glossary("mixin", "믹스인")}}에서 상속받습니다.</p> - -<p><code>activeElement</code> 접근 시점에 텍스트를 블록 선택하고 있는 경우 해당하는 {{htmlelement("input")}}이나 {{htmlelement("textarea")}} 객체를 반환하는데, 그러면 그 객체의 {{domxref("Document.selectionStart", "selectionStart")}}와 {{domxref("Document.selectionEnd", "selectionEnd")}} 메서드를 사용해 선택에 대한 더 자세한 정보를 알아낼 수 있습니다. 포커스가 자주 가는 다른 경우로는 {{htmlelement("select")}} 요소나 <code>type</code>이 <code>"button"</code>, <code>"checkbox"</code>, <code>"radio"</code>인 {{htmlelement("input")}} 요소가 있습니다.</p> - -<p>보통 사용자는 포커스 가능한 요소를 Tab 키를 사용해 탐색할 수 있고, 스페이스 바를 사용해 활성화(버튼을 누르거나 라디오 버튼을 켜는 등)할 수 있습니다. 포커스 가능한 요소는 현재 플랫폼과 브라우저 설정에 따라 다릅니다. 가령 macOS의 경우, 기본값에서는 텍스트 입력 칸이 아니면 보통 포커스 할 수 없습니다.</p> - -<div class="note"> -<p><strong>참고:</strong> 포커스(사용자의 입력 이벤트를 받는 요소)와 선택(문서 내에서 강조하고 있는 부분)은 다릅니다. 현재 선택 영역은 {{domxref("window.getSelection()")}}을 사용해 가져올 수 있습니다.</p> -</div> - -<h2 id="구문">구문</h2> - -<pre class="syntaxbox notranslate"><em>element</em> = <em>DocumentOrShadowRoot</em>.activeElement</pre> - -<h3 id="값">값</h3> - -<p>포커스를 갖고 있는 {{domxref("Element")}}. 그런 요소가 없으면 {{htmlelement("body")}} 또는 {{jsxref("null")}}.</p> - -<h2 id="예제">예제</h2> - -<h3 id="HTML">HTML</h3> - -<pre class="brush: html notranslate"><p>아래 두 영역에서 텍스트를 선택해보세요.</p> - -<form> - <textarea name="ta-example-one" id="ta-example-one" rows="7" cols="40">텍스트 영역 1. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tincidunt, lorem a porttitor molestie, odio nibh iaculis libero, et accumsan nunc orci eu dui.</textarea> - <textarea name="ta-example-two" id="ta-example-two" rows="7" cols="40">텍스트 영역 2. Fusce ullamcorper, nisl ac porttitor adipiscing, urna orci egestas libero, ut accumsan orci lacus laoreet diam. Morbi sed euismod diam.</textarea> -</form> - -<p>활성화된 요소 ID: <b id="output-element"></b></p> -<p>선택한 텍스트: <b id="output-text"></b></p></pre> - -<h3 id="JavaScript">JavaScript</h3> - -<pre class="brush: js notranslate">function onMouseUp(e) { - const activeTextarea = document.activeElement; - const selection = activeTextarea.value.substring( - activeTextarea.selectionStart, activeTextarea.selectionEnd - ); - - const outputElement = document.getElementById('output-element'); - const outputText = document.getElementById('output-text'); - outputElement.innerHTML = activeTextarea.id; - outputText.innerHTML = selection; -} - -const textarea1 = document.getElementById('ta-example-one'); -const textarea2 = document.getElementById('ta-example-two'); -textarea1.addEventListener('mouseup', onMouseUp, false); -textarea2.addEventListener('mouseup', onMouseUp, false);</pre> - -<h3 id="결과">결과</h3> - -<p>{{ EmbedLiveSample('예제', '400', '400') }}</p> - -<h2 id="명세">명세</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - <tr> - <td>{{SpecName('HTML WHATWG', 'interaction.html#dom-document-activeelement', 'activeElement')}}</td> - <td>{{Spec2('HTML WHATWG')}}</td> - <td></td> - </tr> - </tbody> -</table> - -<h2 id="브라우저_호환성">브라우저 호환성</h2> - -<div> - - -<p>{{Compat("api.DocumentOrShadowRoot.activeElement")}}</p> -</div> |
