Officially only $.cssHooks
is documented in jQuery API documentation, and $.valHooks
is mentioned in a sentence for a workaround to a known issue in .val()
.
I wonder how many hooks are there in jQuery besides of these 2, and should we use $.valHooks
in our plugin development? If so, I think it should be documented as a dedicated topic instead of one-sentence only.
There are 8 different types of exposed hooks.
There is one more for internal usage only (which is exposed) - jQuery._queueHooks()
.
There are also two other hooks: nodeHook
and boolHook
which are used internally and their functionality is basically embedded into jQuery.attrHooks
and jQuery.valHooks
.
Here are the important ones:
jQuery.attrHooks
radio
input after the value resets the value in IE6-9.contenteditable
to false on removals (Bug #10429).href
, src
, width
and height
. undefined
in the case of empty string for the style
attribute.value
property in old IEboolHook
or nodeHook
(which is the same as jQuery.valHooks.button
).
jQuery.propHooks
href
/src
properties should get the full normalized URL (Bug #10299, Bug #12915).
jQuery.Tween.propHooks
jQuery.Tween
is used for animations and such.
scrollTop
and scrollLeft
in IE8 - will be removed in jQuery 2.0.
jQuery.cssHooks
Add in style property hooks for overriding the default behavior of getting and setting a style property.
opacity
.witdth
and height
depending on the display
property.width
and height
depending on the box-sizing
property.getComputedStyle
returns percent when specified for top/left/bottom/rightjQuery.fn.animate
to expand specified style properties like margin
, padding
and border
.jQuery.fn.animate
related stuff.inherit
is achieved without using jQuery.cssHooks
, because it is shorter this way.
jQuery.valHooks
option
elements (Bug #6932).select
elements.button
element - id
, name
and coords
. The same as nodeHook
(see above).radio
and checkbox
inputs between Webkit and others.
jQuery.event.fixHooks
A holder for jQuery.event.mouseHooks
and jQuery.event.keyHooks
which require fixing and normalizing based on the support of the current browser.
jQuery.event.mouseHooks
MouseEvent
to the jQuery event object.event.which
(which mouse button was used) accross browsers, because event.button
is not normalized.pageX
, pageY
, clientX
, clientY
and others if missing and set them to the jQuery event object.
jQuery.event.keyHooks
KeyboardEvent
to the jQuery event object.event.which
(the character code of the button which was pressed) across browsers. In the original event it could be char
, charCode
, key
or keyCode
.From the jQuery 1.9.1 source.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With