Bug Tracker

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#7519 closed feature (wontfix)

$.getCSS for v1.5

Reported by: bmcouto@… Owned by:
Priority: low Milestone: 1.5
Component: ajax Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description

Along with the $.getScript, it would be nice to have the same for loading css files and having a callback for it. Basically, addind dataType: 'css' dp the $.ajax() method.

Change History (5)

comment:1 Changed 7 years ago by Rick Waldron

Component: unfiledcss
Priority: undecidedlow
Status: newopen

This might be interesting.

comment:2 Changed 7 years ago by dmethvin

Component: cssajax

Really an ajax enhancement as described.

comment:3 Changed 6 years ago by Rick Waldron

Keywords: ajaxrewrite added

comment:4 Changed 6 years ago by jaubourg

Resolution: wontfix
Status: openclosed

Determining when the stylesheet has been loaded is really tricky.

You obviously cannot use an xhr and create a style element since relative urls would be broken.

So you have to rely on link elements which are pretty inconsistent in the load detection department (I failed to find proper feature detection and had to resort to browser sniffing, though recent work with [algo] on script error detection gave me new ideas in that area).

The worst browser is probably Firefox, for which the code has to control some exception name (which incidently changed from 2.x to 3.x).

So it makes for some very cumbersome code for which error detection is a no go and the requests are prone to non-completion.

I had the css transport in the ajax rewrite initially but I dropped it for the reasons above and decided it was probably better suited for a plugin (since the new ajax is pluggable, it's pretty simple to externalize a transport).

I intend to publish the rejected transports (namely css, xdr and image) in the near future.

Adding a getCSS helper method sure makes sense, though.

comment:5 Changed 6 years ago by jitter

Keywords: ajaxrewrite removed
Note: See TracTickets for help on using tickets.