If you wish to circumvent the API provided by jQuery.override, most of the functions and data that override uses are publicly accessible (not hidden within a closure).
The internal of jQuery.override are subject to change, although override is generally stable and no significant changes are anticipated.

Public properties on $().override include:
  • oFunctions array
A collection of objects with .originalFunction .isOverride and .subscriptions properties.
  • oElements array
A collection of objects with .attr .bindTo and .boundFunc properties.
  • getFunction function
Used to determine if a function has already been overridden, and retrieve it from the array.
  • addFunction function
Used to add a function to the array, if it has not been added already.
  • wrapFunction function
Wraps a function with an invoker and adds the object storing its information to the oFunctions array. The object storing this information is also returned.
  • subscribeFunction function
Finds the function using getFunction and adds a new callback to the .subscriptions array.
  • unsubscribeFunction(oldFunction, newFunction) function
If newFunction is undefined, all subscriptions to the original function will be removed. Otherwise, only the function newFunction will be unsubscribed (removed) from the .subscriptions array.
  • restoreFunction
Returns the original function in its original state. When used with assignment, this restores the function.
legacyFunction = ...restoreFunction(legacyFunction);
  • getElement
Get an object storing element information from the oElements array.
  • addElement(jqElement, attr, bindTo, boundFunc)
Add an object storing element information to the oElements array.
jqElement is the jQuery-wrapped DOM element. attr is the inline attribute. bindTo is the jQuery event subscription passed to .bind(). boundFunc is the callback passed when calling $(...).override(...);. The old state of the attribute is stored in a data-override-* attribute on the element. IE: data-override-onclick.
  • convertInline
Used to convert an element's inline attribute to a jQuery event subscription.
  • restoreElement
Used to restore an element to its original state.

Last edited Dec 24, 2012 at 8:33 PM by aikeru, version 1

Comments

No comments yet.