From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- files/ko/web/api/window/self/index.html | 72 +++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 files/ko/web/api/window/self/index.html (limited to 'files/ko/web/api/window/self') diff --git a/files/ko/web/api/window/self/index.html b/files/ko/web/api/window/self/index.html new file mode 100644 index 0000000000..0e22bd94ed --- /dev/null +++ b/files/ko/web/api/window/self/index.html @@ -0,0 +1,72 @@ +--- +title: Window.self +slug: Web/API/Window/self +tags: + - API + - HTML DOM + - Property + - Read-only + - Reference + - Window +translation_of: Web/API/Window/self +--- +
{{APIRef}}
+ +

Window.self 읽기전용 속성은 자기 자신을 {{domxref("WindowProxy")}}로써 반환합니다. window.self로도 사용할 수 있고, self만 독립적으로 사용해 접근할 수 있습니다. 독립적으로 접근했을 때의 이점은 비 {{jsxref("Window")}} 환경인 {{domxref("Worker", "웹 워커", "", 0)}} 등도 비슷한 표기법을 사용한다는 것입니다. 이 때 selfWindow 문맥에서는 window.self, 워커 문맥에서는 {{domxref("WorkerGlobalScope.self")}}와 같습니다.

+ +

예제

+ +

아래와 같이 쓴 window.self는 그냥 window로 바꿨을 때와 동일합니다.

+ +
if (window.parent.frames[0] != window.self) {
+    // this window is not the first frame in the list
+}
+
+ +

이에 더해 브라우징 문맥의 현재 활성확된 문서에서는 window가 현재 전역 객체를 가리키므로 다음 네 줄의 코드는 모두 동일합니다.

+ +
var w1 = window;
+var w2 = self;
+var w3 = window.window;
+var w4 = window.self;
+// w1, w2, w3, w4 모두 일치. 그러나 워커에서는 w2만 작동함
+
+ +

명세

+ + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', '#dom-self', 'Window.self')}}{{Spec2('HTML WHATWG')}}No difference from the latest snapshot {{SpecName("HTML5.1")}}
{{SpecName('HTML5.1', 'browsers.html#dom-self', 'Window.self')}}{{Spec2('HTML5.1')}}No difference from the {{SpecName("HTML5 W3C")}}
{{SpecName('HTML5 W3C', 'browsers.html#dom-self', 'Window.self')}}{{Spec2('HTML5 W3C')}}First snapshot containing the definition of Window.self.
+ +

브라우저 호환성

+ + + +

{{Compat("api.Window.self")}}

+ +

같이 보기

+ + -- cgit v1.2.3-54-g00ecf