Reputation: 6202
I'm using the frameElement.id JavaScript property to make some changes to the page when nested in a particular iFrame.
There is a case where I have an iFrame with that ID nested in an iFrame with that ID. So it looks like:
Main Page:
<body>
<iframe src="url.htm" id="show_body_only"></iframe>
</body>
url.htm:
<body>
<iframe src="url2.htm" id="show_body_only"></iframe>
</body>
Just wondering if this is semantically correct.
Please do not berate for all the iFrames, I had little choice.
Upvotes: 1
Views: 801
Reputation: 24627
As far as CSS, the spec says:
no two such attributes can have the same value in a conformant document
If the frames explicitly share stylesheets, then the IDs will be applied separately since each frame is its own document.
As far as the DOM, the spec says:
The getElementById(elementId) method must return the first element, in tree order, within context object's descendants, whose ID is elementId, and null if there is no such element otherwise. A node's node document can be changed by the adopt algorithm.
If the frame nodes are imported and adopted, then getElementById
returns the first match.
References
Upvotes: 1