Behavior test for position:fixed

H

Helbrax

Ahh.  Makes sense.  Thanks for that.


Nope.  XHTML Strict validated by w3.  Just to check, I created a div
with inline styles and it is being rendered correctly.  However, both
offsetLeft and oldOffsetLeft are the same.  The same goes for IE6.
Firefox reports that fixed is supported correctly.

Changing the top position to be '1px' instead of '0px' makes it report
correctly on IE7 and IE6.
 
D

David Mark

Ahh. Makes sense. Thanks for that.


Nope. XHTML Strict validated by w3.

Valid documents do not necessarily imply standards mode rendering. IE
will treat XHTML as error-filled HTML as well, but that won't trigger
quirks mode either. Do you have an XML prolog above the doctype?
Just to check, I created a div
with inline styles and it is being rendered correctly. However, both
offsetLeft and oldOffsetLeft are the same. The same goes for IE6.
Firefox reports that fixed is supported correctly.

I don't know what you are doing, but I ran the test here in IE8 and
IE7 (quirks and standards mode) and it worked as expected. Forgot to
remove the added DIV though (be sure to do that).
 
D

David Mark

Changing the top position to be '1px' instead of '0px' makes it report
correctly on IE7 and IE6.

That makes no sense at all and I didn't have to do that to make it
work here, so something else is wrong with your test (post the whole
thing).
 
D

David Mark

That makes no sense at all and I didn't have to do that to make it
work here, so something else is wrong with your test (post the whole
thing).

I'll take a wild guess that you are testing with a completely blank
page. If so, changing it to '1px' is a possible workaround, but not
bullet-proof. Assert the page can't be empty. ;)
 
H

Helbrax

I'll take a wild guess that you are testing with a completely blank
page.  If so, changing it to '1px' is a possible workaround, but not
bullet-proof.  Assert the page can't be empty.  ;)

I found the issue. The body tag was not empty, however it contained
only one element, which was the one with the inline style of position:
fixed. Adding another element without a position style(or explicitly
saying position:static), causes the test to report accurately. It
seems this is exactly what I am looking for. Thanks for the help and
patience.
 
D

David Mark

I found the issue. The body tag was not empty, however it contained
only one element, which was the one with the inline style of position:
fixed. Adding another element without a position style(or explicitly
saying position:static), causes the test to report accurately. It
seems this is exactly what I am looking for. Thanks for the help and
patience.

NP at all. This is what I do. :)
 
D

David Mark

I found the issue. The body tag was not empty, however it contained
only one element, which was the one with the inline style of position:
fixed. Adding another element without a position style(or explicitly
saying position:static), causes the test to report accurately. It
seems this is exactly what I am looking for. Thanks for the help and
patience.

Also, this test will return false if CSS is disabled (or user style
sheets get in the way), which is a bonus as you don't really want to
know if fixed is supported, but whether it will actually work at the
time the document is loaded.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,575
Members
47,207
Latest member
HelenaCani

Latest Threads

Top