File modules/cms/ui/themes/default/script/OQuery.md
Last commit: Thu Apr 15 21:24:23 2021 +0200 Jan Dankert New: Using a Proxy for calling the event handler in the correct context; Added documentation
1 # OQuery 2 3 OQuery is a lightweight ES6-ready replacement for JQuery. 4 5 # Example 6 7 ``` 8 import $ from './OQuery.js'; 9 10 // Selectors 11 $('.myclass').removeClass('otherclass'); 12 13 // Events 14 $('.myclass').children('.subclass').click( function() { 15 $(this).closest('.otherclass').toggleClass('--is-open'); 16 }); 17 ``` 18 19 Modern browsers are accepting this ECMA-Script-6 syntax directly, so there is no need to use webpack. 20 21 # Creating elements 22 23 ``` 24 $.create('div').addClass('myclass').appendTo( $('body') ); 25 ``` 26 27 # Drawbacks 28 29 OQuery is **not** fully feature-compatible to JQuery! 30 31 - No AJAX functions (today we are using the native `fetch`) 32 - No effects 33 - The constructor is only accepting selectors
Downloadmodules/cms/ui/themes/default/script/OQuery.md
History Thu, 15 Apr 2021 21:24:23 +0200 Jan Dankert New: Using a Proxy for calling the event handler in the correct context; Added documentation