Bug Tracker

Opened 6 years ago

Closed 6 years ago

#12909 closed feature (duplicate)

Dynamically loading CSS.

Reported by: sam@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.3
Keywords: Cc:
Blocked by: Blocking:

Description

Currently jQuery offers a very easy way to dynamically load extra javascript via .getScript().

When dynamically loading CSS however, no such function is available. This is generally not a problem since the code sample below does what we need and is still pretty clear. $('head').prepend('<link rel="stylesheet" type="text/css" href="dynamic.js" />');

One of jQuery's strengths is that it normalizes browser specific quirks; for dynamic loading of CSS in IE8 (and maybe others: http://msdn.microsoft.com/en-us/library/ms531194%28VS.85%29.aspx).

Instead a builtin function is avaible in ie8 which must be used, furthermore the loading via $('head').prepend can even cause ie8 to crash, making a website unusable for some user.

I propose adding a new function to jQuery: .getCss(). At the start only 2 arguments would be needed: the url and the index.

Change History (1)

comment:1 Changed 6 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Duplicate of #9832.
I don't think we'd add another method for this, but it would be easily implemented if we do #9832 so I'll mark this ticket as a dup of that.

Note: See TracTickets for help on using tickets.