# 02:40 super() => 부모 constructor를 호출하는데, 자식 constructor 내부에서만 사용 할 수 있다. # 03:56 super.method() => 부모 클래스에 정의된 method를 호출한다. 화살표 함수에는 super가 없다. class Rabbit extends Animal { stop() { setTimeout(() => super.stop(), 1000); // 1초 후에 부모 stop을 호출합니다. } } 화살표 함수의 super는 stop()의 super와 같아서 위 예시는 의도한 대로 동작한다. [의도한 대로 동작하는 이유] setTimeout메서드는 브라우저 환경에서 인수로 전달받은 함수를 호출할 때, this에 window를 할당한다. 이 문제를 해결하기 ..
var closestElement = targetElement.closest(selectors); 선택자와 일치하는 노드를 찾을 때까지 요소와 해당 부모 (문서 루트를 향하는 방향)를 탐색한다. 이 중 가장 가까운 조건에 만족한 부모 요소가 반환되며, 조건에 만족한 요소가 없으면 null 값을 반환한다. [예제] const child = document.querySelector('.child'); let parentSave = child.closest('.container'); let none = child.closest('.none'); 부모 요소가 있으면 요소를 반환하고, 없으면 null을 반환한다. [공부 좌표] Element.closest() 이벤트 위임
- Total
- Today
- Yesterday
- clinetTop
- 대괄포 표기법
- 동등 연산자
- offsetTop
- prototype 프로퍼티
- scrollTop
- __proto__
- 링크막기 #a링크막기
- 프로퍼티
- innerHeight
- 불일치 연산자
- [[Prototype]]
- outerHeight
- clientHeight
- offsetHeight
- 동치 연산자
- scrollHeight
- @font-face
- 일치 연산자
- 점 표기법
- 부등 연산자
- constructor
- property
- 객체의 프로퍼티
- javascript class
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 |