i've attempted to make beet work on as many browsers as possible, but it doesn't always behave correctly on all of them. at the very least, i've been trying to get it to work on IE 5+, Mozilla 1.7+, and konqueror 3.2+
i'm aware that it doesn't function properly on Netscape 4.
this file contains notes about problems i encountered during development of beet, and what to do about them.
i found some severe problems with IE5Mac's position reporting, but they can be overcome in a couple of ways:
IE5Mac doesn't seem to include the <body>
element's margins in the offsetLeft and offsetTop. it also sets up
some default margins (10px?) if you don't specify any margins, i
think. this alone makes the menus that you create show up 10px
higher and further left than you intended. it may also do a
similar thing with padding and border, but i haven't tested it out.
This could potentially be fixed by using javascript to learn the
margin values and add them to the target location. but i'm not
certain what this would do for other browsers who correctly report
these things. the simplest solution is to explicitly set up your
<body> element with 0px margin, padding, and
borders. that removes any of the guesswork.
if you really do want a border or margin or padding for the
<body>, you can just create a single DIV internal
to the body, and give it the border, margin, or padding you
require. IE5 doesn't seem to have any problems reckoning with
those.
IE5Mac reckons the offsetTop of a element from the top of
the surrounding line, not from the top of the span's own box. for
example, if you have this:
<div><img src="foo.png" height="30px"><span>abc</span></div>
and the "abc" span is rendering with 10 pixel-high text, and the
offsetTop of the image is 100, IE5Mac will render the span as
though its offsetTop was 120, but will report offsetTop as 100
because it is in-line with the image. despite reporting a
different offsetTop, it continues to report offsetHeight exactly
the same (10px).
perhaps IE5Mac treats this as a case of an inherited padding or something, rather than a large margin, and you could query the size of the padding to recover from this mistake.
for the demo, i've gotten around this bug by making sure that there are no larger images in-line with the spans. on demo2.html, the image is floated left from the rest of the menubar at the top. when i had included it as part of the div there, the menus would show up too high.
IE5Mac reckons the offsetLeft of a <span>
element without taking
into consideration the enclosing line's text-align property. So
when text-align is "center", it reports the same offsetLeft that it
would report if the text-align had been "left" even though it
renders it further to the right than the reported offset.
i got around this in demo2.html by not centering the menubar, though i think it would look better centered.
you may be able to workaround this by finding some way to coax IE5Mac to report margin or padding widths and taking them into consideration. again, i'm not sure what effect these calculations would have on other browsers.
IE5Mac automatically sets the width of an absolutely positioned
<div> all the way to the right of the viewport
(or maybe even to the right of the document, i'm not sure). Other
browsers make an absolutely-positioned <div>
just wide enough to accomodate the longest contained line.
i got around this in the demo by scanning each menu as it is
created for the maximum offsetWidth of all the menuitems (maxwid),
and then checking the width of the created
<div>. if the created <div>
reports a width much wider than maxwid, i explicitly reset the
width of the div to maxwid plus some small amount to account for
padding/margins whatever.
this fix is a bit of a hack because some extreme stylesheets (really wide margins for menuitems, for example) could conflict with the small amount i'm checking for and force a resize anyway, which would break some menuitems onto multiple lines -- or worse, make them overflow the right-hand side of the menu if they are not line-breakable.
<body> should have a margin, border, and padding of 0px;
beetShrinkDivWidth() made by
beetUpMenuHere().