Skip to main content

Bug Tracker

Side navigation

#6809 closed enhancement (fixed)

Opened July 21, 2010 01:54AM UTC

Closed September 20, 2011 01:05AM UTC

Last modified March 08, 2012 10:00PM UTC

Add jQuery.support.fixedPosition

Reported by: scottgonzalez Owned by: rwaldron
Priority: blocker Milestone: 1.7
Component: support Version: 1.4.2
Keywords: 1.7-discuss Cc:
Blocked by: Blocking:
Description

jQuery already detects support for fixed positioning in the offset code. jQuery.offset.supportsFixedPosition should be moved to jQuery.support.fixedPosition and calculated immediately.

Attachments (0)
Change History (27)

Changed July 21, 2010 03:15AM UTC by dmethvin comment:1

Would it make sense to move the others such as doesNotAddBorder as well?

Changed October 24, 2010 05:01PM UTC by rwaldron comment:2

milestone: 1.4.31.5
priority: → low

Changed October 24, 2010 08:10PM UTC by snover comment:3

status: newopen

Changed November 24, 2010 07:34PM UTC by borisov.gleb@gmail.com comment:4

I think that other properties should live in jQuery.offset, just because they're internal and used only in offset.js.

I have just forked jquery on github and pushed changed to my master-branch. Also created pull-request for this change.

Changed November 24, 2010 08:48PM UTC by rwaldron comment:5

I'm not sure about this particular patch (no offense) but I definitely think this should be reviewed further.

Changed January 03, 2011 12:00AM UTC by paul.irish comment:6

Here is the relevant jQuery.offset.supportsFixedPosition code fwiw:

https://github.com/jquery/jquery/blob/eed380/src/offset.js#L125-143

It should certainly execute lazily, but augmenting jQuery.support proper makes sense to me.

Changed April 16, 2011 10:10PM UTC by john comment:7

milestone: → 1.next

Let's look at this for 1.7.

Changed May 22, 2011 07:27PM UTC by john comment:9

keywords: → 1.7-discuss

Nominating ticket for 1.7 discussion.

Changed May 22, 2011 10:07PM UTC by rwaldron comment:10

+1,

Changed May 23, 2011 12:05AM UTC by jaubourg comment:11

+1, There is no reason why offset should keep a private repository of support properties... ajax does its own support tests yet publishes the result on the main support object.

Changed May 23, 2011 02:06AM UTC by ajpiano comment:12

+1,

Changed May 23, 2011 03:23AM UTC by timmywil comment:13

+1, Makes sense.

Changed May 23, 2011 05:00PM UTC by paul.irish comment:14

+1,

though.. iOS false positives on nearly all written fixed pos tests (incl this one); https://github.com/Modernizr/Modernizr/issues/167

Might be unsolvable and leave it up to docs to explain

Changed May 23, 2011 09:43PM UTC by dmethvin comment:15

+1, If some code can benefit from precomputing it, rather than on-demand, fine.

Changed June 03, 2011 01:33PM UTC by john comment:16

+1, Seems easy enough.

Changed June 03, 2011 02:48PM UTC by scottgonzalez comment:17

+1

Changed June 06, 2011 03:50PM UTC by jzaefferer comment:18

+1

Changed July 12, 2011 02:52PM UTC by dmethvin comment:19

milestone: 1.next1.7
priority: lowblocker

Changed July 12, 2011 08:19PM UTC by iMarc comment:20

_comment0: This false-positive iOS < 5 bug was driving me crazy. The only difference between normal browsers that do support position: fixed and iOS < 5 that I found was that offsetParent is null inside a relative element (code below). Not sure if that is at all related, but I was simply obsessed with locating ''any'' difference I could find that ''might'' be related to the iOS rendering issue of position fixed.. \ \ {{{ \ \ \ var test = document.createElement('div'), \ control = test.cloneNode(false), \ wrap = test.cloneNode(false), \ fake = false, \ root = document.body || (function () { \ fake = true; \ return document.documentElement.appendChild(document.createElement('body')); \ }()); \ \ root.appendChild(wrap); \ wrap.appendChild(test); \ wrap.appendChild(control); \ \ wrap.style.cssText = 'position:relative;'; \ test.style.cssText = 'position:fixed;'; \ control.style.cssText = 'position:absolute;'; \ \ alert(!!control.offsetParent); // alerts true in all browsers, even iOS \ alert(!!test.offsetParent); // alerts false in iOS \ \ if (fake) { \ document.documentElement.removeChild(root); \ } \ \ }}} \ 1310504667139762

(comment deleted)

Changed July 25, 2011 04:07PM UTC by john comment:21

owner: → rwaldron
status: openassigned

Changed July 25, 2011 10:29PM UTC by rwaldron comment:22

The problem I'm initially running into is that support is generally run before before the real body actually exists... I think I can work around that, draft implementation to follow.

Changed July 25, 2011 10:55PM UTC by rwaldron comment:23

Working draft: https://github.com/rwldrn/jquery/tree/6809

Currently the only failing tests are:

offset: body (2, 0, 2)

Changed August 15, 2011 04:13PM UTC by john comment:24

Isn't this the case where you can do:

body = document.createElement("body");

to get the body element, even if it doesn't exist yet?

Changed August 15, 2011 04:16PM UTC by rwaldron comment:25

_comment0: Yes - I'm using document.body if it happens to exist early enough or the fake body that the support module has already created as a backup1313426701012951

Yes - I'm using document.body if it happens to exist early enough or the fake body that the support module has already created as a backup

@ https://github.com/rwldrn/jquery/commit/1f1990431a9abb8e964825e5bf7bd7c1eb28fa1b

Changed September 17, 2011 03:02PM UTC by anonymous comment:26

This works: http://mnobeta.no/2011/09/test-position-fixed-for-iphone/

On iphone. Android needs to be taken care of.

Changed September 20, 2011 01:05AM UTC by Rick Waldron comment:27

resolution: → fixed
status: assignedclosed

Landing pull request 477. 1.7 jQuery.offset.supportsFixedPosition. Fixes #6809.

More Details:

Changeset: f60213648cefa9b53289ad01a55ead22a15e6ee1