Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
wants to merge 1 commit into from

4 participants

Brian Edgerton Gonzalo Rubio Olmo Maldonado Sergio Crisostomo
Brian Edgerton

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'
element.style.position === 'fixed'

element.currentStyle.position === 'absolute'

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

Brian Edgerton

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

Gonzalo Rubio
Collaborator

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

Brian Edgerton

Happens on the current WP7 release.

Olmo Maldonado ibolmo modified the milestone: 1.5.1, 1.5
Olmo Maldonado ibolmo added the bug label
Olmo Maldonado
Owner

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

Olmo Maldonado ibolmo modified the milestone: 1.5.2, 1.5.1
Olmo Maldonado
Owner

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

Brian Edgerton

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

Olmo Maldonado
Owner

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 authored
    …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
View
@@ -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';
+
+ container.style.cssText = "position:absolute; top: 2px; visibility:hidden";
+ fixed_div.style.cssText ='position:fixed; top:'+top_offset;
+
+ container.appendChild(fixed_div);
+ body.insertBefore( container, body.firstChild );
+
+ var coords = $(fixed_div).getCoordinates(),
+ supports_fixed_position = (coords.top === parseInt(top_offset));
+
+ body.removeChild(container);
+ return supports_fixed_position;
+ })();
beforeEach(function(){
container = new Element('div');
@@ -28,7 +46,7 @@ describe('Element.getOffsetParent', function(){
td = new Element('td').inject(new Element('tr').inject(table));
container.inject(document.body);
-
+
});
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.