aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/event/target
diff options
context:
space:
mode:
Diffstat (limited to 'files/ko/web/api/event/target')
-rw-r--r--files/ko/web/api/event/target/index.html96
1 files changed, 96 insertions, 0 deletions
diff --git a/files/ko/web/api/event/target/index.html b/files/ko/web/api/event/target/index.html
new file mode 100644
index 0000000000..02fbdd8726
--- /dev/null
+++ b/files/ko/web/api/event/target/index.html
@@ -0,0 +1,96 @@
+---
+title: Event.target
+slug: Web/API/Event/target
+tags:
+ - 돔
+ - 레퍼런스
+ - 속성
+ - 이벤트
+ - 타겟
+translation_of: Web/API/Event/target
+---
+<p>{{ApiRef("DOM")}}</p>
+
+<p>{{domxref("Event")}} interface의 <code><strong>target</strong></code> 속성은  event가 전달한 객체에 대한 참조입니다. 이는 이벤트의 버블링 또는 캡처 단계에서 이벤트 핸들러를 호출하는 {{domxref("Event.currentTarget")}}와 다릅니다.</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox notranslate">theTarget = event.target</pre>
+
+<h3 id="Value">Value</h3>
+
+<p>{{domxref("EventTarget")}}</p>
+
+<h2 id="Example">Example</h2>
+
+<p><code>event.target</code> 속성을 사용하여 <strong>event delegation</strong>을 구현할 수 있습니다.</p>
+
+<pre class="brush: js notranslate">// Make a list
+var ul = document.createElement('ul');
+document.body.appendChild(ul);
+
+var li1 = document.createElement('li');
+var li2 = document.createElement('li');
+ul.appendChild(li1);
+ul.appendChild(li2);
+
+function hide(e){
+  // e.target refers to the clicked &lt;li&gt; element
+  // This is different than e.currentTarget which would refer to the parent &lt;ul&gt; in this context
+  e.target.style.visibility = 'hidden';
+}
+
+// Attach the listener to the list
+// It will fire when each &lt;li&gt; is clicked
+ul.addEventListener('click', hide, false);
+</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th>Specification</th>
+ <th>Status</th>
+ <th>Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName("DOM WHATWG", "#dom-event-target", "Event.target")}}</td>
+ <td>{{Spec2("DOM WHATWG")}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName("DOM4", "#dom-event-target", "Event.target")}}</td>
+ <td>{{Spec2("DOM4")}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName("DOM2 Events", "#Events-Event-target", "Event.target")}}</td>
+ <td>{{Spec2("DOM2 Events")}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("api.Event.target")}}</p>
+
+<h2 id="Compatibility_notes">Compatibility notes</h2>
+
+<p>On IE 6-8 the event model is different. Event listeners are attached with the non-standard {{domxref('EventTarget.attachEvent')}} method. In this model, the event object has a {{domxref('Event.srcElement')}} property, instead of the <code>target</code> property, and it has the same semantics as <code>event.target</code>.</p>
+
+<pre class="brush: js notranslate">function hide(e) {
+ // Support IE6-8
+ var target = e.target || e.srcElement;
+ target.style.visibility = 'hidden';
+}
+</pre>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/API/Event/Comparison_of_Event_Targets">Comparison of Event Targets</a></li>
+</ul>