Czy relacja między <ramką> a dokumentem jest w jedną stronę?
Możesz zdobyć węzłydocument
obiekt<iframe>
zcontentDocument
własnośćHTMLIFrameElement
Ale nie mogę znaleźć sposobu na zdobycie<iframe>
z powrotem z węzła.
Czy relacja między<iframe>
a jego dokument to tylko jeden sposób?
Jeśli to robi,CZEMU?
var iframe = document.getElementById('iframe');
var doc = iframe.contentDocument || iframe.contentWindow.document;
var div = doc.getElementsByTagName('div')[0];
console.log('Did we find the iframe? ' + ($(div).closest('iframe').length > 0));
// Output: "Did we find the iframe? false"