Change proposal: Adding a sprite attribute to img tags

It would be nice to be able to specify which images should be downloaded
together in one gzipped file.

For instance, presently we have code which looks like the following:
img src="pic1.png"
img src="pic2.png"

Presently these images are sent with two separate requests.  With a new
attribute, a flag can be set to specify that they should be sent down the
wire together in one gzip:
img src="pic1.png" spriteid="1"
img src="pic2.png" spriteid="1"

This would allow the use of multiple spriteids for multiple sets of
"sprites".

The actual request to the server might look something like this (this is
influenced by the way YUI3 uses combo handling for JS):
http://domain.com/?spriteid=1&pic1.png&pic2.png

The server would recognize this sprite directive by the "spriteid" in the
url, and it would return a single gzip of the files.  Also, this gracefully
degrades, as older browsers would ignore "spriteid" and simply request the
images normally.  Obviously the actual change would be pretty dramatic, as
it would require a change both on the server side (Apache, etc) as well as
browsers.

If others find this proposal helpful, it might make sense to also allow
spriteid (or something like it) on other elements as well (script, etc.).

-David

Received on Friday, 4 December 2009 01:16:56 UTC