diff --git a/class/class.js b/class/class.js index dc9f8c4d..38771b9b 100644 --- a/class/class.js +++ b/class/class.js @@ -7,11 +7,5 @@ steal("can/construct/proxy","can/construct/super",function( $ ) { $.Class = can.Construct; - var old = $.Class.extend; - $.Class.extend = function() { - var cls = old.apply(this, arguments); - cls.prototype.Class = cls.prototype.constructor; - cls.prototype.callback = cls.prototype.proxy; - return cls; - } + })(); diff --git a/controller/controller.js b/controller/controller.js index fecbec26..2d735d3b 100644 --- a/controller/controller.js +++ b/controller/controller.js @@ -4,7 +4,4 @@ steal('jquery/class','can/control/plugin',function( $ ) { $.fn.controller = $.fn.control; $.fn.controllers = $.fn.controllers; - $.Controller.prototype.find = function(selector) { - return this.element.find(selector); - } }); diff --git a/dom/compare/compare.js b/dom/compare/compare.js index 400e87c2..5bdcaa64 100644 --- a/dom/compare/compare.js +++ b/dom/compare/compare.js @@ -1,46 +1,5 @@ -/** - * @add jQuery.fn - */ steal('jquery/dom').then(function($){ -/** - * @function compare - * @parent dom - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/dom/compare/compare.js - * - * Compares the position of two nodes and returns a bitmask detailing how they are positioned - * relative to each other. - * - * $('#foo').compare($('#bar')) //-> Number - * - * You can expect it to return the same results as - * [http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-compareDocumentPosition | compareDocumentPosition]. - * Parts of this documentation and source come from [http://ejohn.org/blog/comparing-document-position | John Resig]. - * - * ## Demo - * @demo jquery/dom/compare/compare.html - * @test jquery/dom/compare/qunit.html - * @plugin dom/compare - * - * - * @param {HTMLElement|jQuery} element an element or jQuery collection to compare against. - * @return {Number} A bitmap number representing how the elements are positioned from each other. - * - * If the code looks like: - * - * $('#foo').compare($('#bar')) //-> Number - * - * Number is a bitmap with with the following values: - * - * - * - * - * - * - * - * - *
BitsNumberMeaning
0000000Elements are identical.
0000011The nodes are in different - * documents (or one is outside of a document).
0000102#bar precedes #foo.
0001004#foo precedes #bar.
0010008#bar contains #foo.
01000016#foo contains #bar.
- */ + jQuery.fn.compare = function(element){ //usually //element is usually a relatedTarget, but element/c it is we have to avoid a few FF errors diff --git a/dom/compare/compare.md b/dom/compare/compare.md new file mode 100644 index 00000000..49b9fa03 --- /dev/null +++ b/dom/compare/compare.md @@ -0,0 +1,37 @@ +@page jQuery.compare +@parent jquerypp +@test jquery/dom/compare/qunit.html +@plugin dom/compare + +Compares the position of two nodes and returns a bitmask detailing how they are positioned +relative to each other. + + $('#foo').compare($('#bar')) //-> Number + +You can expect it to return the same results as +[http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-compareDocumentPosition | compareDocumentPosition]. +Parts of this documentation and source come from [http://ejohn.org/blog/comparing-document-position | John Resig]. + +## Demo +@demo jquery/dom/compare/compare.html + + + +@param {HTMLElement|jQuery} element an element or jQuery collection to compare against. +@return {Number} A bitmap number representing how the elements are positioned from each other. + +If the code looks like: + + $('#foo').compare($('#bar')) //-> Number + +Number is a bitmap with with the following values: + + + + + + + + +
BitsNumberMeaning
0000000Elements are identical.
0000011The nodes are in different + documents (or one is outside of a document).
0000102#bar precedes #foo.
0001004#foo precedes #bar.
0010008#bar contains #foo.
01000016#foo contains #bar.
\ No newline at end of file diff --git a/dom/cookie/cookie.js b/dom/cookie/cookie.js index 5ca88cb7..e7bdca3b 100644 --- a/dom/cookie/cookie.js +++ b/dom/cookie/cookie.js @@ -2,7 +2,7 @@ steal('jquery/lang/json',function() { // break /** * @function jQuery.cookie - * @parent dom + * @parent jquerypp * @plugin jquery/dom/cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de * diff --git a/dom/cur_styles/cur_styles.js b/dom/cur_styles/cur_styles.js index a563d5b4..3538ff35 100644 --- a/dom/cur_styles/cur_styles.js +++ b/dom/cur_styles/cur_styles.js @@ -17,16 +17,7 @@ steal('jquery/dom').then(function( $ ) { rfloat = /float/i, rnumpx = /^-?\d+(?:px)?$/i, rnum = /^-?\d/; - /** - * @add jQuery - */ - // - /** - * @function curStyles - * @param {HTMLElement} el - * @param {Array} styles An array of style names like ['marginTop','borderLeft'] - * @return {Object} an object of style:value pairs. Style names are camelCase. - */ + $.curStyles = function( el, styles ) { if (!el ) { return null; @@ -78,40 +69,16 @@ steal('jquery/dom').then(function( $ ) { return results; }; - /** - * @add jQuery.fn - */ - - $.fn /** - * @parent dom - * @plugin jquery/dom/cur_styles - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/dom/cur_styles/cur_styles.js - * @test jquery/dom/cur_styles/qunit.html - * Use curStyles to rapidly get a bunch of computed styles from an element. - *

Quick Example

- * @codestart - * $("#foo").curStyles('float','display') //-> - * // { - * // cssFloat: "left", display: "block" - * // } - * @codeend - *

Use

- *

An element's computed style is the current calculated style of the property. - * This is different than the values on element.style as - * element.style doesn't reflect styles provided by css or the browser's default - * css properties.

- *

Getting computed values individually is expensive! This plugin lets you get all - * the style properties you need all at once.

- *

Demo

- *

The following demo illustrates the performance improvement curStyle provides by providing - * a faster 'height' jQuery function called 'fastHeight'.

- * @demo jquery/dom/cur_styles/cur_styles.html + * @function jQuery.fn.curStyles + * + * @parent jQuery.curStyles + * @plugin jQuery.curStyles * @param {String} style pass style names as arguments * @return {Object} an object of style:value pairs */ - .curStyles = function() { + $.fn.curStyles = function() { return $.curStyles(this[0], $.makeArray(arguments)); }; }); \ No newline at end of file diff --git a/dom/cur_styles/curstyles.md b/dom/cur_styles/curstyles.md new file mode 100644 index 00000000..90847d5f --- /dev/null +++ b/dom/cur_styles/curstyles.md @@ -0,0 +1,30 @@ +@page jQuery.curStyles +@parent jquerypp + +Use curStyles to rapidly get a bunch of computed styles from an element. + +## Quick Example + + + $("#foo").curStyles('float','display') //-> + // { + // cssFloat: "left", display: "block" + // } + +## Use + +An element's __computed__ style is the current calculated style of the property. +This is different than the values on `element.style` as +`element.style` doesn't reflect styles provided by css or the browser's default +css properties. + +Getting computed values individually is expensive! This plugin lets you get all +the style properties you need all at once. + +## Demo + +The following demo illustrates the performance improvement curStyle provides by providing +a faster 'height' jQuery function called 'fastHeight'. + +@demo jquery/dom/cur_styles/cur_styles.html + diff --git a/dom/dimensions/dimensions.js b/dom/dimensions/dimensions.js index 2296b91d..8f208454 100644 --- a/dom/dimensions/dimensions.js +++ b/dom/dimensions/dimensions.js @@ -1,36 +1,5 @@ steal('jquery/dom/cur_styles').then(function($) { -/** - * @page dimensions dimensions - * @parent dom - * @plugin jquery/dom/dimensions - * - * The dimensions plugin adds support for setting+animating inner+outer height and widths. - * - * ### Quick Examples - * - * $('#foo').outerWidth(100).innerHeight(50); - * $('#bar').animate({outerWidth: 500}); - * - * ## Use - * - * When writing reusable plugins, you often want to - * set or animate an element's width and height that include its padding, - * border, or margin. This is especially important in plugins that - * allow custom styling. - * - * The dimensions plugin overwrites [jQuery.fn.outerHeight outerHeight], - * [jQuery.fn.outerWidth outerWidth], [jQuery.fn.innerHeight innerHeight] - * and [jQuery.fn.innerWidth innerWidth] - * to let you set and animate these properties. - * - * - * - * - * ## Demo - * - * @demo jquery/dom/dimensions/dimensions.html - */ var weird = /button|select/i, //margin is inside border getBoxes = {}, @@ -42,14 +11,12 @@ var weird = /button|select/i, //margin is inside border oldInnerWidth: $.fn.innerWidth, oldInnerHeight: $.fn.innerHeight }; -/** - * @add jQuery.fn - */ + $.each({ /** - * @function outerWidth - * @parent dimensions + * @function $.fn.outerWidth + * @parent jQuery.dimensions * Lets you set the outer width on an object * @param {Number} [height] * @param {Boolean} [includeMargin=false] Makes setting the outerWidth adjust @@ -61,15 +28,15 @@ $.each({ */ width: /** - * @function innerWidth - * @parent dimensions + * @function $.fn.innerWidth + * @parent jQuery.dimensions * Lets you set the inner height of an object * @param {Number} [height] */ "Width", /** - * @function outerHeight - * @parent dimensions + * @function $.fn.outerHeight + * @parent jQuery.dimensions * Lets you set the outer height of an object where:
* outerHeight = height + padding + border + (margin). * @codestart @@ -88,8 +55,8 @@ width: */ height: /** - * @function innerHeight - * @parent dimensions + * @function $.fn.innerHeight + * @parent jQuery.dimensions * Lets you set the outer width on an object * @param {Number} [height] */ diff --git a/dom/dimensions/dimensions.md b/dom/dimensions/dimensions.md new file mode 100644 index 00000000..59094124 --- /dev/null +++ b/dom/dimensions/dimensions.md @@ -0,0 +1,27 @@ +@page jQuery.dimensions +@parent jquerypp + +@plugin jquery/dom/dimensions + +The dimensions plugin adds support for setting+animating inner+outer height and widths. + +### Quick Examples + + $('#foo').outerWidth(100).innerHeight(50); + $('#bar').animate({outerWidth: 500}); + +## Use + +When writing reusable plugins, you often want to +set or animate an element's width and height that include its padding, +border, or margin. This is especially important in plugins that +allow custom styling. + +The dimensions plugin overwrites [jQuery.fn.outerHeight outerHeight], +[jQuery.fn.outerWidth outerWidth], [jQuery.fn.innerHeight innerHeight] +and [jQuery.fn.innerWidth innerWidth] +to let you set and animate these properties. + +## Demo + +@demo jquery/dom/dimensions/dimensions.html \ No newline at end of file diff --git a/dom/fixture/fixture.js b/dom/fixture/fixture.js index 93c82a75..721f15d2 100644 --- a/dom/fixture/fixture.js +++ b/dom/fixture/fixture.js @@ -1,3 +1,3 @@ -steal('can/util/fixture',function($){ - $.fixture = can.fixture; -}) +steal('can/util/fixture').then(function($) { + jQuery.fixture = can.fixture; +}); diff --git a/dom/form_params/form_params.js b/dom/form_params/form_params.js index 0234c4d4..0c7f7311 100644 --- a/dom/form_params/form_params.js +++ b/dom/form_params/form_params.js @@ -1,6 +1,3 @@ -/** - * @add jQuery.fn - */ steal("jquery/dom").then(function( $ ) { var keyBreaker = /[^\[\]]+/g, convertValue = function( value ) { @@ -55,40 +52,6 @@ steal("jquery/dom").then(function( $ ) { }; $.fn.extend({ - /** - * @parent dom - * @download http://jmvcsite.heroku.com/pluginify?plugins[]=jquery/dom/form_params/form_params.js - * @plugin jquery/dom/form_params - * @test jquery/dom/form_params/qunit.html - * - * Returns an object of name-value pairs that represents values in a form. - * It is able to nest values whose element's name has square brackets. - * - * When convert is set to true strings that represent numbers and booleans will - * be converted and empty string will not be added to the object. - * - * Example html: - * @codestart html - * <form> - * <input name="foo[bar]" value='2'/> - * <input name="foo[ced]" value='4'/> - * <form/> - * @codeend - * Example code: - * - * $('form').formParams() //-> { foo:{bar:'2', ced: '4'} } - * - * - * @demo jquery/dom/form_params/form_params.html - * - * @param {Object} [params] If an object is passed, the form will be repopulated - * with the values of the object based on the name of the inputs within - * the form - * @param {Boolean} [convert=false] True if strings that look like numbers - * and booleans should be converted and if empty string should not be added - * to the result. Defaults to false. - * @return {Object} An object of name-value pairs. - */ formParams: function( params ) { var convert; diff --git a/dom/form_params/formparams.md b/dom/form_params/formparams.md new file mode 100644 index 00000000..4a727cda --- /dev/null +++ b/dom/form_params/formparams.md @@ -0,0 +1,32 @@ +@page jQuery.formParams +@parent jquerypp + +@plugin jquery/dom/form_params +@test jquery/dom/form_params/qunit.html + +Returns an object of name-value pairs that represents values in a form. +It is able to nest values whose element's name has square brackets. + +When convert is set to true strings that represent numbers and booleans will +be converted and empty string will not be added to the object. + +Example html: +@codestart html +<form> + <input name="foo[bar]" value='2'/> + <input name="foo[ced]" value='4'/> +<form/> +@codeend +Example code: + + $('form').formParams() //-> { foo:{bar:'2', ced: '4'} } + +@demo jquery/dom/form_params/form_params.html + +@param {Object} [params] If an object is passed, the form will be repopulated +with the values of the object based on the name of the inputs within +the form +@param {Boolean} [convert=false] True if strings that look like numbers +and booleans should be converted and if empty string should not be added +to the result. Defaults to false. +@return {Object} An object of name-value pairs. diff --git a/dom/range/range.md b/dom/range/range.md new file mode 100644 index 00000000..46d53769 --- /dev/null +++ b/dom/range/range.md @@ -0,0 +1,2 @@ +@page jQuery.range +@parent jquerypp diff --git a/dom/route/route.js b/dom/route/route.js index 0b5bdc76..a84912de 100644 --- a/dom/route/route.js +++ b/dom/route/route.js @@ -1,4 +1,4 @@ steal('can/route', 'jquery/event/hashchange', function( $ ) { - $.route=can.route + $.route = can.route }) \ No newline at end of file diff --git a/dom/selection/selection.md b/dom/selection/selection.md new file mode 100644 index 00000000..4d8efcf6 --- /dev/null +++ b/dom/selection/selection.md @@ -0,0 +1,2 @@ +@page jQuery.selection +@parent jquerypp diff --git a/event/default/default.md b/event/default/default.md new file mode 100644 index 00000000..0448144c --- /dev/null +++ b/event/default/default.md @@ -0,0 +1,2 @@ +@page jQuery.event.default +@parent jquerypp diff --git a/event/destroyed/destroyed.md b/event/destroyed/destroyed.md new file mode 100644 index 00000000..9b47ecd1 --- /dev/null +++ b/event/destroyed/destroyed.md @@ -0,0 +1,2 @@ +@page jQuery.event.destroyed +@parent jquerypp diff --git a/event/drag/drag.js b/event/drag/drag.js index 78f2dfd2..b67eae8d 100644 --- a/event/drag/drag.js +++ b/event/drag/drag.js @@ -11,8 +11,44 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ event = $.event, clearSelection = window.getSelection ? function(){ window.getSelection().removeAllRanges() - } : function(){}; - // var handle = event.handle; //unused + } : function(){}, + supportTouch = typeof window.Touch === 'object', + touchDown = "ontouchdown" in document, + mouseEvents = { + touchstart: 'mousedown', + touchmove: 'mousemove', + touchend: 'mouseup' + }, + makeMouseEvent = function( event ) { + if ( event.xConverted ) { + return event; + } + + var touch = event.originalEvent.changedTouches[0]; + + return touch ? $.extend(event, { + type: mouseEvents[event.type], + which: 1, + pageX: touch.pageX, + pageY: touch.pageY, + screenX: touch.screenX, + screenY: touch.screenY, + clientX: touch.clientX, + clientY: touch.clientY, + xConverted : true + }) : event + }, + startEvent, moveEvent, stopEvent; + + if ( supportTouch ) { + startEvent = "touchstart"; + moveEvent = "touchmove"; + stopEvent = "touchend"; + } else { + startEvent = "mousedown"; + moveEvent = "mousemove"; + stopEvent = "mouseup"; + } /** * @class jQuery.Drag * @parent specialevents @@ -98,17 +134,21 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ */ mousedown: function( ev, element ) { var isLeftButton = ev.button === 0 || ev.button == 1; - if (!isLeftButton || this.current ) { + if ( ! supportTouch && ( !isLeftButton || this.current )) { return; } //only allows 1 drag at a time, but in future could allow more //ev.preventDefault(); //create Drag + if ( supportTouch ) { + makeMouseEvent( ev ); + } var drag = new $.Drag(), delegate = ev.delegateTarget || element, selector = ev.handleObj.selector, self = this; this.current = drag; + drag.setup({ element: element, delegate: ev.delegateTarget || element, @@ -135,6 +175,11 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ */ $.extend($.Drag.prototype, { setup: function( options, ev ) { + + if ( supportTouch ) { + makeMouseEvent( ev ); + } + $.extend(this, options); this.element = $(this.element); this.event = ev; @@ -148,8 +193,8 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ this.mouseStartPosition = ev.vector(); //where the mouse is located - $(document).bind('mousemove', mousemove); - $(document).bind('mouseup', mouseup); + $(document).bind(moveEvent, mousemove); + $(document).bind(stopEvent, mouseup); if (!this.callEvents('down', this.element, ev) ) { this.noSelection(this.delegate); @@ -162,8 +207,8 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ * @hide */ destroy: function() { - $(document).unbind('mousemove', this._mousemove); - $(document).unbind('mouseup', this._mouseup); + $(document).unbind(moveEvent, this._mousemove); + $(document).unbind(stopEvent, this._mouseup); if (!this.moved ) { this.event = this.element = null; } @@ -172,6 +217,9 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ this.destroyed(); }, mousemove: function( docEl, ev ) { + if ( supportTouch ) { + makeMouseEvent( ev ); + } if (!this.moved ) { var dist = Math.sqrt( Math.pow( ev.pageX - this.event.pageX, 2 ) + Math.pow( ev.pageY - this.event.pageY, 2 )); if(dist < this._distance){ @@ -191,6 +239,9 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ }, mouseup: function( docEl, event ) { + if ( supportTouch ) { + makeMouseEvent( event ); + } //if there is a current, we should call its dragstop if ( this.moved ) { this.end(event); @@ -240,6 +291,11 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ }, init: function( element, event ) { + + if ( supportTouch ) { + makeMouseEvent( event ); + } + element = $(element); var startElement = (this.movingElement = (this.element = $(element))); //the element that has been clicked on //if a mousemove has come after the click @@ -285,6 +341,11 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ } }, callEvents: function( type, element, event, drop ) { + + if ( supportTouch ) { + makeMouseEvent( event ); + } + var i, cbs = this.callbacks[this.constructor.lowerName + type]; for ( i = 0; i < cbs.length; i++ ) { cbs[i].call(element, event, this, drop); @@ -301,6 +362,11 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ }, //draws the position of the dragmove object draw: function( pointer, event ) { + + if ( supportTouch ) { + makeMouseEvent( event ); + } + // only drag if we haven't been cancelled; if ( this._cancelled ) { return; @@ -379,6 +445,11 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ * @param {Event} event a mouseup event signalling drag/drop has completed */ end: function( event ) { + + if ( supportTouch ) { + makeMouseEvent( event ); + } + if ( this._cancelled ) { return; } @@ -571,7 +642,7 @@ steal('jquery/event', 'jquery/lang/vector', 'jquery/event/livehack',function( $ * Called when the drag is done. *

Drag events are covered in more detail in [jQuery.Drag].

*/ - 'dragend'], "mousedown", function( e ) { + 'dragend'], startEvent, function( e ) { $.Drag.mousedown.call($.Drag, e, this); }); diff --git a/event/drag/drag.md b/event/drag/drag.md new file mode 100644 index 00000000..8508eada --- /dev/null +++ b/event/drag/drag.md @@ -0,0 +1,2 @@ +@page jQuery.event.drop +@parent jquerypp diff --git a/event/drop/drop.md b/event/drop/drop.md new file mode 100644 index 00000000..0448144c --- /dev/null +++ b/event/drop/drop.md @@ -0,0 +1,2 @@ +@page jQuery.event.default +@parent jquerypp diff --git a/event/hover/hover.md b/event/hover/hover.md new file mode 100644 index 00000000..0a8a67cd --- /dev/null +++ b/event/hover/hover.md @@ -0,0 +1,2 @@ +@page jQuery.event.hover +@parent jquerypp diff --git a/event/key/key.md b/event/key/key.md new file mode 100644 index 00000000..7a8496f9 --- /dev/null +++ b/event/key/key.md @@ -0,0 +1,2 @@ +@page jQuery.event.key +@parent jquerypp diff --git a/event/resize/resize.md b/event/resize/resize.md new file mode 100644 index 00000000..2e4e28aa --- /dev/null +++ b/event/resize/resize.md @@ -0,0 +1,2 @@ +@page jQuery.event.resize +@parent jquerypp diff --git a/event/selection/selection.md b/event/selection/selection.md new file mode 100644 index 00000000..fcb8af0b --- /dev/null +++ b/event/selection/selection.md @@ -0,0 +1,2 @@ +@page jQuery.event.selection +@parent jquerypp diff --git a/event/swipe/swipe.md b/event/swipe/swipe.md new file mode 100644 index 00000000..4695db20 --- /dev/null +++ b/event/swipe/swipe.md @@ -0,0 +1,2 @@ +@page jQuery.event.swipe +@parent jquerypp diff --git a/event/tap/tap.md b/event/tap/tap.md new file mode 100644 index 00000000..5b44d622 --- /dev/null +++ b/event/tap/tap.md @@ -0,0 +1,2 @@ +@page jQuery.event.tap +@parent jquerypp diff --git a/jquerypp.md b/jquerypp.md new file mode 100644 index 00000000..2cf5b446 --- /dev/null +++ b/jquerypp.md @@ -0,0 +1,46 @@ +@page jquerypp jQuery++ +@parent index 1 +@description jQuery Model View Controller and extensions. + +jQuery++ is a collection of useful jQuery libraries that provide +the missing functionality necessary to +implement and organize large-scale jQuery applications. + +## DOM Helpers + +[dom DOM helpers] extend jQuery with extra functionality for +manipulating the DOM. For example, [dimensions] lets you set the +outer width and height of elements like: + + $('#foo').outerWidth(500); + +THe following are the other dom plugins: + + - [jQuery.cookie Cookie] - Set and get cookie values. + - [jQuery.fixture Fixture] - Simulate Ajax responses. + - [jQuery.fn.closest Closest] - Use the open child selector in event delegation. + - [jQuery.fn.compare Compare] - Compare the location of two elements rapidly. + - [jQuery.fn.curStyles CurStyles] - Get multiple css properties quickly. + - [jQuery.fn.formParams FormParams] - Serializes a form into a JSON-like object. + - [jQuery.fn.selection Selection] - Gets or sets the current text selection. + - [jQuery.fn.within Within] - Returns elements that have a point within their boundaries. + - [jQuery.Range Range] - Text range utilities. + - [jQuery.route] - Routes for history-enabled ajax apps. + +## Special Events + +jQueryMX comes packed with jQuery [specialevents special events] and event helpers. + + - [jQuery.Drag Drag] - Delegatable drag events. + - [jQuery.Drop Drop] - Delegatable drop events. + - [jQuery.Hover Hover] - Delegatable hover events. + - [jQuery.event.special.destroyed Destroyed] - Know when an element is removed from the page. + - [jQuery.event.special.resize Resize] - Listen to resize events on any element. + - [jQuery.event.swipe Swipe] - Delegatable swipe events. + - [jQuery.Event.prototype.key Key] - Get the character from a key event. + - [jQuery.event.special.default Default] - Provide default behaviors for events. + - [jquery.event.pause Pause-Resume] - Pause and resume event propagation. + + + - [jQuery.Vector Vector] - vector math + diff --git a/model/test/qunit/model_test.js b/model/test/qunit/model_test.js index cbb2a7b6..6714f272 100644 --- a/model/test/qunit/model_test.js +++ b/model/test/qunit/model_test.js @@ -97,13 +97,14 @@ test("save deferred", function(){ data : attrs, type : 'post', dataType : "json", - fixture: function(){ - return [{id: 5}] - }, success : success }) } },{}); + + $.fixture('POST /people', function() { + return {id: 5}; + }); var person = new Person({name: "Justin"}), personD = person.save(); @@ -126,13 +127,14 @@ test("update deferred", function(){ data : attrs, type : 'post', dataType : "json", - fixture: function(){ - return [{thing: "er"}] - }, success : success }) } },{}); + + $.fixture('POST /people/5', function() { + return { thing: "er" }; + }); var person = new Person({name: "Justin", id:5}), personD = person.save(); @@ -154,9 +156,6 @@ test("destroy deferred", function(){ url : "/people/"+id, type : 'post', dataType : "json", - fixture: function(){ - return [{thing: "er"}] - }, success : success }) } @@ -457,8 +456,8 @@ test("save error args", function(){ }) var st = '{type: "unauthorized"}'; - $.fixture("/testinmodelsfoos.json", function(){ - return [401,st] + $.fixture("/testinmodelsfoos.json", function(originalOptions, respond){ + respond(401, st); }); stop(); var inst = new Foo({}).save(function(){