I'm currently looking at a website in production (with caches and all) but with no JS and CSS aggregation.

Once every 4 request or so javascript crashes at if (jQuery.support.positionFixed === undefined) because jQuery.support is actually undefined and you can't look for .positionFixed in undefined. The tests done in jQuery to build the support object are not trivial and can take time and since this piece of code is contained in a self-executing closure it can be executed before jQuery had time to build $.support and crashes all the js.

Since this is only required by tableheader which is far from being added to every page, I'm invoking the same reasoning as to why we don't need a jQuery.support.resizeCSS : #20 and that we should use the same approach as #15.

The crash described is pretty rare and js aggregation would most likely avoid the problem, but it's still an issue and that code certainly doesn't need to run on every page.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikemadison’s picture

For what it's worth, I ran into a problem on a development site today. Your D7 patch solved my issue.

I'm not sure exactly what caused the issue, I can tell you I'm running D7.10. The page in question was trying to execute the Colorbox module, as well as the QuickTabs module.

QuickTabs was loading, Colorbox was not, so I assume that it was somehow related to Colorbox. Once I did the patch, everything was fine.

nod_’s picture

That's nice to know but unless you're sure it's the same error you've been experiencing it can't really count as a test.

Glad that ended up helping you though :)

Status: Needs review » Needs work

The last submitted patch, core-js-remove-positionFixed-D7.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review

What's wrong with the bot? since when does it test -D7 patches?

Damien Tournoud’s picture

Status: Needs review » Postponed (maintainer needs more info)

Let's try to understand why this happens. The patch in here looks like just a workaround.

Our addition is in .ready() because it relies on the <body> tag being defined. On the other hand, the code in jQuery that initializes jQuery.support is directly in the main scope of jquery.js (and as a consequence should be executed when jQuery is loaded).

So the only reason for jQuery.support to be undefined would be that drupal.js is loaded before jquery.js. Why would that happen?

nod_’s picture

Status: Postponed (maintainer needs more info) » Needs work
FileSize
1.04 KB

Actually…

D7 patch still stands.

nod_’s picture

Status: Needs work » Needs review
nod_’s picture

Title: Remove $.support.positionFixed, racing condition crashes JS » drop $.support.positionFixed use jQuery's $.support.fixedPosition

Another no-brainer for D8.

nod_’s picture

Issue tags: +frontend performance
nod_’s picture

The jQuery documentation is not up to date, here is the relevant ticket adding this thing to $.support: http://bugs.jquery.com/ticket/6809

amateescu’s picture

Title: drop $.support.positionFixed use jQuery's $.support.fixedPosition » Drop our custom $.support.positionFixed and use jQuery's $.support.fixedPosition
Category: bug » task
Status: Needs review » Reviewed & tested by the community

I went through this issue today with @nod_ and neither of us couldn't reproduce the initial bug report in Chrome 17 (or FF 11 fwiw) so I suppose it was a bug in an earlier Chrome version.

With the bug report out of the way, I'd say this is a nice and small improvement for D8, now that we have jQuery 1.7.

catch’s picture

Title: Drop our custom $.support.positionFixed and use jQuery's $.support.fixedPosition » Change notification for: Drop our custom $.support.positionFixed and use jQuery's $.support.fixedPosition
Priority: Normal » Critical
Status: Reviewed & tested by the community » Active

Looks likes great clean-up.

I've not come across the original bug report, if it's no longer possible to reproduce then I'm happy to ignore that and just take the clean-up patch as is, so I've committed/pushed it to 8.x.

This will need a change notification.

ifriz’s picture

Assigned: Unassigned » ifriz

I am going to write the change notification.

ifriz’s picture

Title: Change notification for: Drop our custom $.support.positionFixed and use jQuery's $.support.fixedPosition » Drop our custom $.support.positionFixed and use jQuery's $.support.fixedPosition
Assigned: ifriz » Unassigned
Status: Active » Fixed

Change record was created.
http://drupal.org/node/1497012

nod_’s picture

Status: Fixed » Needs work

Thanks for taking that on :)

The text could use some work. try to make a somewhat pleasant sentence, it's a bit dry like that.

Also a change notif needs review as well, don't just fix it without second opinion.

The important thing here is that we don't make our own check anymore since jQuery already provide the information we need. it's a renaming.

nod_’s picture

Status: Needs work » Fixed

Made a few changes, hopefully that'll be clearer.

amateescu’s picture

Priority: Critical » Normal

Yep, looks cleaner.

nod_’s picture

Updated the title as well, forgot to change it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

seutje’s picture

Status: Closed (fixed) » Active

Looks like updating jQuery broke this, as it seems like they dropped $.support.fixedPosition -> https://github.com/jquery/jquery/commit/77536f5cb2ab042ac8be40ba59f36d8f...

also, since we support only IE8 and up, can we just get rid of this test and assume position: fixed; is always supported?

nod_’s picture

+1 to that.

Jelle_S’s picture

Status: Active » Needs review
FileSize
402 bytes

Should be a simple patch... Don't think testbot will have problems with it.

Status: Needs review » Needs work

The last submitted patch, core-js-remove-fixedPosition-1439462-22.patch, failed testing.

Jelle_S’s picture

Failed 1 test:

Two entities loaded by uid without caring about property translatability.

Retesting because this doesn't seem related...

Jelle_S’s picture

Status: Needs work » Needs review
seutje’s picture

Status: Needs review » Reviewed & tested by the community

Odd, why wouldn't it pass? o.O

Looks good to me!

Jelle_S’s picture

@seutje because the bot doesn't like me :-( ;-)

Now we just have to wait for one of the core committers to swing by...

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Agreed that this can be removed. Committed.

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

ortho

catch’s picture

Issue summary: View changes
FileSize
1.11 KB

Found this doing some performance optimization of a 7.x site - causes a recalculate styles/layout due to the adding/checking height of/removing element.

Here's a 7.x backport for sites that don't support IE8. Don't see a way to backport this, unfortunately we made that property part of the 7.x API, when it really should have been contained in tableheader.js.