Prevent multiple inclusions of jQuery UI

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: Prevent multiple inclusions of jQuery UI

Post by imkingdavid »

Ahh, so I think I'm confusing "include it with the core" and "load it on every page whether it's used or not".

I think the general consensus supports including it with the core package, but only in such a way as to not load it on pages that don't require its functionality. Does that seem accurate?

If we were to implement something like the suggested libraries that manage which libraries are needed on each page load, would that library use less resources itself than just including jQuery UI by default?
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: Prevent multiple inclusions of jQuery UI

Post by brunoais »

imkingdavid wrote: I think the general consensus supports including it with the core package, but only in such a way as to not load it on pages that don't require its functionality. Does that seem accurate?
I'm ok with that.
imkingdavid wrote: If we were to implement something like the suggested libraries that manage which libraries are needed on each page load, would that library use less resources itself than just including jQuery UI by default?
Things like includeJS & cia use very minimal amount of processing and it would do most work on the client.

Ofc, if jQuery UI is used every single time, no exceptions, it's best not to have that extra code in the first place but if it is used only sometimes, then it makes a lot of sense, at least, to me.

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: Prevent multiple inclusions of jQuery UI

Post by MichaelC »

This could be resolved for 3.2 anyway with extension dependencies and have them require an extension that includes just jQuery UI. This issue comes up a lot with symfony bundles that need jQuery etc. as they all bundle it.

Have the MOD team decided how to bundle extension zip packages yet? If its from the board root or ext/ then multiple extensions could be included in the zip file and people can include a phpbb/jquery-ui extension in their package. The only problem's you'd have then would be if they are using different jQuery UI versions but that would be an extension conflict anyway, nothing we can really do about that.

Otherwise, it's including it in the core (which I don't have an objection to. I'm just airing the other options).
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: Prevent multiple inclusions of jQuery UI

Post by EXreaction »

How do they handle it in Symfony? What kind of issues can come up?

The problem I see with jQuery UI is that it has specific style elements/design to it, so it will have to be unique per style and every style will need to include it/make sure the elements are styled correctly for their custom style.

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: Prevent multiple inclusions of jQuery UI

Post by nickvergessen »

I ignore all Symfony and 3.2 discussion for now.

What we could do easy is something like:
<!-- IF $LOAD_JQUERY_UI --><!-- INCLUDEJS jquery.ui.js --><!-- ENDIF -->

This way, ext authors can easily load it (by just setting $LOAD_JQUERY_UI to true) and it does not waste resources when its not used.
Member of the Development-TeamNo Support via PM

Alien_Time
Registered User
Posts: 165
Joined: Fri Apr 05, 2013 3:38 am

Re: Prevent multiple inclusions of jQuery UI

Post by Alien_Time »

What happens when someone wants to use a different theme in jquery ui?

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: Prevent multiple inclusions of jQuery UI

Post by MichaelC »

EXreaction wrote:How do they handle it in Symfony? What kind of issues can come up?

The problem I see with jQuery UI is that it has specific style elements/design to it, so it will have to be unique per style and every style will need to include it/make sure the elements are styled correctly for their custom style.
Symfony (Or composer world in general) - There is no solution. We have this all the time with bundles including jQuery, UI, Bootstrap etc. and it does cause issues. Jordi, the composer (co-)lead developer, appealed for anyone to come up with a solution.

I see your point. Unless extensions are packaged to ext/ or / then I think joas' solution is the best one.
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
MattF
Extension Customisations
Extension Customisations
Posts: 675
Joined: Mon Mar 08, 2010 9:18 am

Re: Prevent multiple inclusions of jQuery UI

Post by MattF »

Alien_Time wrote:What happens when someone wants to use a different theme in jquery ui?
Themes should not present as much of an issue. Themes come in namespaced folders, and are just CSS files (and images).

So an ext. author can use any theme they want, and include it in their ext package. While this means it would be possible that multiple themes could be loaded on a board by different extensions each using their own themes, there should not really be any conflicts since each theme has its own name.

The only issue may be if themes of the same name, but different versions are loaded at the same time by different extensions. But if thats the case, its easy to identify and fix.

Of course having said all that, how many extensions does anybody think are actually going to use jQuery UI (or UI themes)? Not a whole lot I think.
Has an irascible disposition.

Alien_Time
Registered User
Posts: 165
Joined: Fri Apr 05, 2013 3:38 am

Re: Prevent multiple inclusions of jQuery UI

Post by Alien_Time »

That makes sense VSE. In that case, including jquery ui js in the phpbb package and then having the ability to enable it similar to the nickvergessen's suggestion will work well.

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: Prevent multiple inclusions of jQuery UI

Post by imkingdavid »

nickvergessen wrote:I ignore all Symfony and 3.2 discussion for now.

What we could do easy is something like:
<!-- IF $LOAD_JQUERY_UI --><!-- INCLUDEJS jquery.ui.js --><!-- ENDIF -->

This way, ext authors can easily load it (by just setting $LOAD_JQUERY_UI to true) and it does not waste resources when its not used.
That sounds like a great idea. Of course, you need to set $LOAD_JQUERY_UI once you've included it.
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

Post Reply