Closed Bug 227301 Opened 22 years ago Closed 22 years ago

OBJECT tag with data="#" results in odd, recursive rendering

Categories

(Core :: Layout, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: mcow, Unassigned)

Details

Attachments

(1 file)

While playing around with declared and reinstantiated objects, I loaded my test page in Mozilla and saw something very odd: the syntax I was trying for the reinstantiated object resulted in the entire page being displayed within the space of the object; and then inside that nested page, the page was itself once again rendered within the space of the object. Curiously, the nesting only extended to two levels. The aforementioned syntax was: <object declare id="ximg" type="image/png" data="ref.png"> </object> … <object data="#ximg"></object> It turns out the '#' itself caused the nesting. Attachment to follow.
This test case's object renders in IE6 as simply [alt] which seems like the best solution. In Opera7, it renders as an empty rectangle of default-object size. I am aware that the 'declare' for <object> is not implemented in Mozilla (bug 164979), but the nesting currently exhibited seems pretty wrong. See also bug 96976, bug 108946.
> <object data="#ximg"></object> That resolves to the URI of the current document with a "#ximg" tacked on to the end. So the right behavior there is to load the current document in the <object>, which is what we do. Why exactly is this "pretty wrong"? The behavior should be identical to typing the document URI as the value of the data attribute; anything else is a bug.... The nesting limit may be a bug, though it may also be something we are imposing explicitly... I'd need to do some debugging to figure that out for sure.
I was using "#ximg" following the model here: http://www.w3.org/TR/html401/struct/objects.html#h-13.3.4 If <object declare id="ximg"...> were supported, then #ximg would refer to that declared object. I see your point that Mozilla is handling this "correctly" but it still seems wrong -- it doesn't seem like an effect that would be desirable. Certainly if it were infinitely recursed, it would be a problem. The same results are achieved if the data attribute is set to the name of the source file, and I guess suppressing *that* wouldn't make any sense; so in that sense Mozilla is doing the right thing. Suppose somewhere in the document there was: <p id="foo">My Macro Text</p> Would it then make sense for <object data="#foo"> to simply render a copy of that element, rather than the entire document? This does, of course, still open up to the possibility of recursion. Since infinite recursion is undesirable, I would prefer seeing Mozilla recurse once rather than twice. I just don't see any advantage to going any deeper than that.
> I was using "#ximg" following the model here: Right. And this model is brain-damaged in that correct handling of it by a UA that does NOT implement declare leads to the bizarre behavior you see. The HTML spec is in fact rife with the assumption that a fragment identifier is not really a URI, which is false... > it doesn't seem like an effect that would be desirable. Nevertheless, it's the right thing to do. White text on a white background is also not desirable, yet trivial to trigger with HTML. > Would it then make sense for <object data="#foo"> to simply render a copy of > that element, rather than the entire document? No sure. The spec is pretty unclear on that issue... And this would be nearly impossible to do, by the way. The reason we only recurse twice is that we have a limit of "3" on the number of nested frames that can contain the "same" url (with possible differences in the ref). See http://lxr.mozilla.org/seamonkey/source/content/base/src/nsFrameLoader.cpp#71 Any limit here will break some sites; "3" was chosen because it's the biggest one (hence breaking fewest sites) that still leaves total number of frames reasonable in most cases.
OK, then I guess there's no problem. Thanks for looking!
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: