diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2014-01-21 23:14:37 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2014-01-21 23:14:37 +0100 |
commit | c2e656869af6782d3b02ab81b08ea728da0f05db (patch) | |
tree | fe79ca6a60b389fd0047485eeef871688c51a503 /jQuery-PORTING.txt | |
parent | 2fdb1e997f030155bd6648f9d72a77ccecda0324 (diff) |
Added quickstart doc for query upgrade
Diffstat (limited to 'jQuery-PORTING.txt')
-rw-r--r-- | jQuery-PORTING.txt | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/jQuery-PORTING.txt b/jQuery-PORTING.txt deleted file mode 100644 index 7737e38d..00000000 --- a/jQuery-PORTING.txt +++ /dev/null @@ -1,127 +0,0 @@ -BASIC PROTOTYPE->JQUERY JAVASCRIPT -Rule #1: look up the jQuery documentation at http://api.jquery.com/ ---- -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) ---- -Execute a function when the page 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"); ---- -Get element size -OLD: element.getWidth(), element.getHeight() -NEW: element.width, element.height ---- -Hook on ajax events -OLD: Ajax.Responders.register({"onLoading" : my_function }); -OLD: Ajax.Responders.register({"onSuccess" : my_function }); -NEW: $( document ).ajaxSend(my_function); -NEW: $( document ).ajaxSuccess(my_function); - - - -PRADO SPECIFIC CHANGES ---- -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 postback: you need to create a new object -OLD: Prado.PostBack(options, event); -NEW: new Prado.PostBack(options, event); ---- -Test browser: removed. Test for browser support for specific capabilities instead -OLD: Prado.Browser().ie -NEW: jQuery.support ---- -Focus an element -OLD: Prado.Element.focus(element); -NEW: $(element).focus(); - - - -SPECIFIC CONTROLS - -Some Prado controls were based on specific extensions of the prototype+scriptaculous javascript framework, and they have been deprecated now that jQuery has become the primary js framework in prado. -While we provide the jQuery-based counterpart for these controls and encourage everyone to port their code, the old controls are still supposed to work with some minor annoyance: - * prototype and scriptaculous will be loaded along jQuery; - * jQuery will be put in "no conflict" mode, so the $() helper won't call anymore jQuery but prototype. - -Following is the list of deprecated controls. ---- -TAutoCompleter is deprecated, use TJuiAutoComplete instead. -In the case you want to update your code: - * No more Frequency property. - * minChars property is now minLength - * only the ItemTemplate is supported for the Suggestions repeater (no HeaderTemplate, FooterTemplate, ...); - * 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 is deprecated, use TJuiDraggable instead. -In the case you want to update your code: - * Check jQuery-ui's Draggable options. ---- -TDropContainer is deprecated, use TJuiDroppable instead. -In the case you want to update your code: - * Check jQuery-ui's Droppable options. - * The event parameter format has changed a bit. ---- |