summaryrefslogtreecommitdiff
path: root/jQuery-PORTING.txt
blob: 16b3276988ef05066af9885ee8a253c9e510d0ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
JAVASCRIPT

Get element by id
OLD: $('element_id')
NEW: $('#element_id') // for the extended element
NEW: $('#element_id').get(0) // for the base DOM element
---
Get element by css selector
OLD: $$('.class')
NEW: $('.class')
---
Apply a function to multiple elements
OLD: $$('.class').each(Element.remove);
NEW: $('.class').remove();
---
Class creation/extension

OLD: Class.create(Prado.WebUI.TActiveImageButton, { ... })
OLD: Class.extend(Prado.WebUI.TActiveImageButton, { ... })
NEW: jQuery.klass(Prado.WebUI.TActiveImageButton, { ... })
---
Extending an object
OLD: Object.extend(...)
NEW: jQuery.extend(...)
---
Bind an event to a callback event handler
OLD: Event.observe(element, 'click', callback)
NEW: $(element).on('click', callback)
---
Bind an event to a callback event handler
OLD: Event.stopObserving(element, 'click', callback)
NEW: $(element).off('click', callback)
---
Stopping event propagation
OLD: Event.stop(event)
NEW: event.stopPropagation() or event.preventDefault()
---
Detect keypress event: use the numeric codes
OLD: if(kc == Event.KEY_RETURN || kc == Event.KEY_SPACEBAR || kc == Event.KEY_TAB)
NEW: if(kc == 13 || kc == 32 || kc == 9)
---
Implementing the postback handler for a PostBackControl; the function signature has changed (parameters are inverted):
OLD: onPostBack : function(event, options)
NEW: onPostBack : function(options, event)
---
Execute a function when the pagfe has finished loading
OLD: document.observe("dom:loaded", function(event) { ... });
NEW: $( document ).ready(function() { ... });
---
Create an animation effect with a "finish" callback
OLD: new Effect.Fade(element, {duration: 400, afterFinish: function() { // Animation complete. });
NEW: $(element).fadeOut( 400, function() { // Animation complete. });
---
Declare a function to be used as event handler binding its "this" property
OLD: this.functionName.bindAsEventListener(this);
NEW: this.functionName.bind(this);
---
Css class functions
OLD: addClassName, removeClassName, hasClassName
NEW: addClass, removeClass, hasClass
---
Get event target
OLD: Event.element(event)
NEW: event.target
---
Get event mouse position
OLD: Event.pointerX(event), Event.pointerY(event);
NEW: event.pageX, event.pageY;
---
Fire events
OLD: Event.fireEvent(this.control, "change");
NEW: $(element).trigger("change");
---
Test browser
OLD: Prado.Browser().ie
NEW: jQuery.support
---
Focus an element
OLD: Prado.Element.focus(element);
NEW: $(element).focus();
---
Get element size
OLD: element.getWidth(), element.getHeight()
NEW: element.width, element.height



CONTROLS

TAutoCompleter doesn't exists anymore, use TJuiAutoComplete instead, upgrading the code:
 * No more Frequency property.
 * minChars property is now minLength 
 * only the ItemTemplate is supported for the Suggestions repeater;
 * in the ItemTemplate you don't need to render the <li/> anymore, but only the content itself
 * No Multiple selection support (by now, can be added in the future)
---
TDraggable doesn't exists anymore, use TJuiDraggable instead, upgrading the code:
 * Use jQuery-ui's Draggable options.
---
TDropContainer doesn't exists anymore, use TJuiDroppable instead, upgrading the code:
 * Use jQuery-ui's Droppable options.
 * The event parameter format has changed a bit.
---