How can I select and manipulate elements of all window.frames being generated by each SVG within a <object>
tag that I put on the page?
I'm trying to add events click()
to elements <g>
of the .svg files loaded dynamically into divs within the element object using the data
attribute. The files and the index page are in the same domain.
For the time being, I'm only able to manipulate the elements when the window index is given. where svg is. I thought it was possible to load everything in the main window to take advantage of a single document.
But apparently ...
W3.org 13.5 Notes on embedded documents
"An embedded document is entirely independent of the document in which it is embedded"
"An embedded document is completely independent of the document it is embedded in."
"If a document contains frames (tags), the browser creates a window object for the HTML document, and one additional window object for each frame."
"If a document contains frames (tags), the browser creates a window object for the HTML document and an additional window object for each frame."
This image is the DOM panel scenario
For each added svg added a new index and a Window
.
Theindexisthus
whereeachWindowintheDOMpanelisthepaththatisbeingassignedattrdata
.
<!-- Html reduzido só para mostrar em que posição do
Html ele está e como estão seus atributos, lembrando
que o attr data recebe um php:pdo query e a div .svg
é gerado dinamicamente através de um condição e echo
php -->
<html>
<head>
<script/>
</head>
<body>
<div></div>
<div></div>...
<?php
if($condicao){
echo "
<div class='svg'>
<object id='svg_id' data= ' ".$evt['local']." ' type='image/svg+xml' ></object>
</div>";
?>
</html>