Permalink
Browse files

Adding cssHook gotcha

This is definitely true in 1.8, but probably true in older versions as well. It may be a bug, but since it's in a version, I figured I'd let people know.
  • Loading branch information...
1 parent e742ede commit 1ee46fad427114e7423ae890083436edba72718c @SlexAxton SlexAxton committed Aug 13, 2012
Showing with 13 additions and 8 deletions.
  1. +13 −8 entries/jQuery.cssHooks.xml
@@ -19,14 +19,19 @@
return;
}
- $.cssHooks["someCSSProp"] = {
- get: function( elem, computed, extra ) {
- // handle getting the CSS property
- },
- set: function( elem, value ) {
- // handle setting the CSS value
- }
- };
+ // Wrap in a document ready call, because jQuery writes
+ // cssHooks at this time and will blow away your functions
+ // if they exist.
+ $(function () {
+ $.cssHooks["someCSSProp"] = {
+ get: function( elem, computed, extra ) {
+ // handle getting the CSS property
+ },
+ set: function( elem, value ) {
+ // handle setting the CSS value
+ }
+ };
+ });
})(jQuery);
</code>
</pre>

0 comments on commit 1ee46fa

Please sign in to comment.