이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 함께 해서 번역을 마치도록 도와 주세요!
The Node.contains()
method returns a Boolean
value indicating whether a node is a descendant of a given node or not.
Syntax
node.contains( otherNode )
Example
This function checks to see if an element is in the page's body. As contains
is inclusive and determining if the body contains itself isn't the intention of isInPage
this case explicitly returns false
.
function isInPage(node) { return (node === document.body) ? false : document.body.contains(node); }
Specifications
Specification | Status | Comment |
---|---|---|
DOM The definition of 'Node.contains()' in that specification. |
Living Standard | Initial definition |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | 9.0 (9.0) | 5.0[1] | (Yes) | 3.0[2] |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ? | 9.0 (9.0) | ? | ? | ? |
[1] Internet Explorer only supports contains()
for elements.
[2] Safari 2.x implemented contains()
incorrectly.
See also
문서 태그 및 공헌자
태그:
이 페이지의 공헌자:
Sebastianz,
gluecksmelodie,
JacksonGL,
fscholz,
teoli,
JamesGreene,
bwrrp,
kscarfone,
namolmes,
t0dd.moz,
Sheppy,
peter_mclarnan,
JorisW,
ethertank,
mattcg,
ziyunfei,
gilesburdett,
RobertWHurst,
Bzbarsky,
paul.irish
최종 변경:
Sebastianz,