#CCCCCC) or rgb color (
rgb(100,100,100)) formulas as well as plain-text well-known color keywords (
blue) - this is drastically different than what would go into something like say the width property - which would simply be a fixed size or percentage. It was at this point that we came to the conclusion that jquery-encoder should use the property name that is being encoded for to determine the correct escaping syntax.
The new API for the property aware encodeForXXX methods follows
Returns the encoded
property: valuepair, escaped in the context of the passed in property. Banned properties are the
evalwithin a style context. If the optional
truethe function will return only the
valueencoded for the passed in property.
Returns the encoded
attribute="value"pair, escaped in the context of the passed in attribute. Banned attributes are
srcas those should be encoded using the
on*are also banned as they should be set using the
styleattribute should be set using the
encodeForCSSfunction. If the optional
omitAttributeNameparameter is true, the function will return only the
valueencoded for the passed in attribute.
In all cases, the property/attribute names are canonicalized prior to encoding to validate and get the escaping context for that property (or the default if there is no specific context specified)
This was a somewhat difficult decision to make, simply because it is mixing in a bit of validation with the output encoding control - which is not necessarily ideal from a pure design standpoint. I felt however, that this was a necessary evil in order to ensure correct encoding/escaping context and get the most value from the plugin.
Please continue to send me your thoughts and ideas for the plugin - I plan on releasing it to the general public through the jQuery plugin repository within the next couple weeks so any feedback from the community leading up to the release of the plugin will only make it stronger!
As always, the latest version of the plugin is available from my github
The sandbox (which will be updated with the latest version today) is available on my site: