Dimensions pulled into Core including Safari bug!
Hi guys,
I've posted this before, but now dimensions is actually pulled into
the core it's even more important the bug is solved. As Safari is a
supported browser, I think this should really be addressed:
The bug occurs with the following code:
<style>
#contentLayer {
position: absolute;
margin: auto;
overflow: hidden;
left: 0;
top: 114px;
bottom: 41px;
width: 100%;
text-align: center;
}
.content{
width: 888px;
margin: auto;
text-align: left;
}
Safari would be the only browser giving me a completely wrong position
using:
$('.content').position();
I was able to solve the problem, without introducing others as far as
I could see, by changing the dimensions 1.2
plugin on line 90 (inside the position() function), replacing:
offset.top -= num(elem, 'marginTop');
offset.left -= num(elem,
'marginLeft');
with:
if (!$.browser.safari) {
offset.top -= num(elem, 'marginTop');
offset.left -= num(elem,
'marginLeft');
}
The problem here was that offset.left was exactly the same as
num(elem, 'marginLeft'), which would result in 0.
</style>
<div id="contentLayer"><div><div class="content">
<!-- content stuff -->
</div></div></div>
Now another problem with Safari. On $(document).ready I would run a
script which makes use of jquery 1.2.3 and dimensions 1.2 to calculate
the width and position of the .content, which would completely fail,
as seemingly Safari did as of yet know the correct width and height of
elements. The .width() function would give a completely wrong result.
The width problem was solved by replacing:
$(initNav);
wtih:
setTimeout(function() { $(initNav); }, 0);
Perhaps the $(fdocument).ready() needs a revisit for Safari?
Cheers,
Yereth