Bug Tracker

Ticket #7519 (closed feature: wontfix)

Opened 4 years ago

Last modified 4 years ago

$.getCSS for v1.5

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

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

comment:1 Changed 4 years ago by rwaldron

  • Priority changed from undecided to low
  • Status changed from new to open
  • Component changed from unfiled to css

This might be interesting.

comment:2 Changed 4 years ago by dmethvin

  • Component changed from css to ajax

Really an ajax enhancement as described.

comment:3 Changed 4 years ago by rwaldron

  • Keywords ajaxrewrite added

comment:4 Changed 4 years ago by jaubourg

  • Status changed from open to closed
  • Resolution set to wontfix

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 4 years ago by jitter

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