Extending an existing jQuery function

Sure… Just save a reference to the existing function, and call it: (function($) { // maintain a reference to the existing function var oldcss = $.fn.css; // …before overwriting the jQuery extension point $.fn.css = function() { // original behavior – use function.apply to preserve context var ret = oldcss.apply(this, arguments); // stuff I will … Read more

jquery extend vs angular extend

angular.extend and jQuery.extend are very similar. They both do a shallow property copy from one or more source objects to a destination object. So for instance: var src = {foo: “bar”, baz: {}}; var dst = {}; whatever.extend(dst, src); console.log(dst.foo); // “bar” console.log(dst.baz === src.baz); // “true”, it’s a shallow copy, both // point to … Read more