jquery-cssHooks icon indicating copy to clipboard operation
jquery-cssHooks copied to clipboard

Multi-value properties (text-shadow, box-shadow, etc)

Open pdokas opened this issue 14 years ago • 2 comments

It would be good to support the CSS properties that can contain comma-separated values. A problem in doing so is that there's no defined name for these sub-values in the CSS specs. Names like textShadow0, textShadow1, … textShadowN seem reasonable enough. However, implementing them presents a significant architectural problem.

We'd need to populate $.cssHooks with each textShadowN value (and its subvalues, like textShadow3Color?) but obviously we can't just do that because N is unbounded. It seems like we need to dynamically create the necessary cssHook at the beginning of a get/set/animate call. I've studied the problem and it seems to require support from within jQuery itself but it's also seeming like going beyond reasonable scope.

Any thoughts? Is there need for this sort of thing? I mean, just imagine the fun that could be had on http://mothereffingtextshadow.com/ with such an ability ;)

pdokas avatar Nov 15 '10 17:11 pdokas

It would be good if someone wanted to changed say the third text shadow in a list of different text shadows.

Although certain browsers, like Opera, only allow a max of 6-9 text shadows. Safari 1 only supports one. It may be best to set a maximum yourself and test to see whether a browser supports 1 or multiple.

More info here (bottom of page): https://developer.mozilla.org/en/CSS/text-shadow

tomgrohl avatar Nov 15 '10 19:11 tomgrohl

Indeed. Safari only supported a single shadow until 4.0 as well. “Gecko (Firefox) theoretically supports infinite text-shadows (don't try it).” is a fun sentence.

The worry is that since there's no stated limit to number of shadows, in the spec or generally agreed-upon, we can't assume any specific cap. And without a cap there's no way to prepopulate all the necessary $.cssHooks values.

pdokas avatar Nov 15 '10 19:11 pdokas