Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Old 11-24-2004, 10:04 PM   PM User | #1
brothercake
Senior Coder


 
Join Date: Jun 2002
Location: near Oswestry
Posts: 4,509
Thanks: 0
Thanked 0 Times in 0 Posts
brothercake is an unknown quantity at this point
WTF is going on here?

Yeah sorry that's such a vague title ... but basically, I'm hunting down what may or may not be a CSS or JS bug in one or more browsers ... but I can't really make head nor tail of what's going on.

Here's the URL: http://www.brothercake.com/Ref/mp-something.html

The demo page does three thing:

- click the red square and it tells you it's offset position with an iterative* function

- click the light purple square and it's undisplayed, changing the rest of the layout accordingly

- double-click the light grey central area (which is the BODY) and it becomes position:relative instead of position:static

Using Firefox and Opera 7, or Firefox and Safari, as comparitors - try playing around with that page. change the states of the test elements; get the position of the red square at various states;

Something's wrong there in Opera 7 and Safari ... probably more than one thing ... but I've lost the plot with this - I just can't work out what's happening or why.

* thanks to jkd for reminding me of the difference between recursion and iteration
__________________
"Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

Last edited by brothercake; 11-25-2004 at 12:04 AM..
brothercake is offline   Reply With Quote
Old 11-25-2004, 12:30 AM   PM User | #2
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enough
Hmm;
Code:
            initial     pclicked        bodyclick       body&pclicked
ff1.0m      0   0       0   0           0   0           0   0
op7.6m      10  100     10  10          10  100         10  10
saf1.2      10  100     10  10          10  100         10  10
msnosx      0   0       n/a n/a         10  10          n/a n/a
ie5.2m      -10 -10     n/a n/a         0   0           n/a n/a
From the results, I read this out:

- Ff1.0m: Rendering is correct, but not offsets. It adds the offsets of div and body with both static and positioned body, and the body offset is calculated to zero. Offset values and offset parents are broken.

- Op7.6 and Saf1.2: Rendering is correct, so are offsets. It adds the offsets of div and body in both cases, and in both cases body is correctly calculated. Offset parents are broken.

- MSN/OSX: It doesn't render the p because it's empty, but if it wasn't empty you would get the same results irrespective of whether the p was clicked or not. It doesn't seem to collapse the p margin with the body margin. It adds div and html offsets if static body, div and body offsets if positioned body. Margin collapsing broken.

- Ie5.2m: Rendering is same as MSN/OSX. It adds div and body offsets in both cases, but the div is calculated to minus ten in the static case, zero in the positioned case. Offset parents, offset values and margin collapsing broken.


For testing, add a fullstop or something to the p. Also, a better getRealPosition for inspection:
Code:
function getRealPosition(a,b){
    var
        c=0;
    do
        alert(a.tagName+'\n'+(c+=b=='x'?a.offsetLeft:a.offsetTop));
    while(a=a.offsetParent);
    return c;
}
__________________
liorean <[lio@wg]>
Articles: RegEx evolt wsabstract , Named Arguments
Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

Last edited by liorean; 11-25-2004 at 12:34 AM..
liorean is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:04 PM.

Home - Contact Us - Archives - Link to CF - Resources - Top 

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.