Skip to content


Fixes #2396. Feature check for position:fixed support #2397

wants to merge 1 commit into from

4 participants


Feature test for position:fixed support solves failing test in Windows Phone. Runs as expected in FF, Safari, Chrome on OS X and IE7+.

Setting position: fixed in Win Phone yields strange results:

element.setStyle('position', 'fixed');
element.getStyle('position') === 'fixed' === 'fixed'

element.currentStyle.position === 'absolute'

This was causing getOffsetParent() to return an empty div instead of null in this test.


I should add, with this check in place, Windows Phone 7 passes all core-1.4 Specs.


just out of curiosity, does this happen on WP7 pre-Mango or on the current Mango/Tango release?


Happens on the current WP7 release.

@ibolmo ibolmo modified the milestone: 1.5.1, 1.5
@ibolmo ibolmo added the bug label

Could you help us and run the latest specs against windows phone?

@ibolmo ibolmo modified the milestone: 1.5.2, 1.5.1

@brianedgerton once again, can you help us run the latest specs against your windows phone?


Sorry, I'm not not working on WP any more and do not have the environment set up.


Thanks. I'm giving a week deadline on this and closing if ages further. Don't have WP access either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 8, 2012
  1. Fixes #2396. Feature check for position:fixed support to solve failin…

    Brian Edgerton committed
    …g test in Win Phone.
This page is out of date. Refresh to see the latest.
Showing with 24 additions and 7 deletions.
  1. +24 −7 Specs/1.3client/Element/Element.Dimensions.js
31 Specs/1.3client/Element/Element.Dimensions.js
@@ -8,7 +8,25 @@ provides: [Element.Dimensions.Specs]
describe('Element.getOffsetParent', function(){
- var container, offsetParent, wrapper, child, table, td;
+ var container, offsetParent, wrapper, child, table, td,
+ supportsFixedPosition = (function() {
+ var body = document.body,
+ container = document.createElement("div"),
+ fixed_div = document.createElement("div"),
+ top_offset = '1px';
+ = "position:absolute; top: 2px; visibility:hidden";
+ ='position:fixed; top:'+top_offset;
+ container.appendChild(fixed_div);
+ body.insertBefore( container, body.firstChild );
+ var coords = $(fixed_div).getCoordinates(),
+ supports_fixed_position = ( === parseInt(top_offset));
+ body.removeChild(container);
+ return supports_fixed_position;
+ })();
container = new Element('div');
@@ -28,7 +46,7 @@ describe('Element.getOffsetParent', function(){
td = new Element('td').inject(new Element('tr').inject(table));
it('Should return the right offsetParent', function(){
@@ -66,11 +84,10 @@ describe('Element.getOffsetParent', function(){
it('Should return null for elements with position:fixed', function(){
- table.setStyle('position', 'fixed');
- expect(table.getOffsetParent()).toBeNull();
+ if (supportsFixedPosition) {
+ table.setStyle('position', 'fixed');
+ expect(table.getOffsetParent()).toBeNull();
+ }
it('Should return null for the body element', function(){
Something went wrong with that request. Please try again.