openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

OQuery.md (683B)


      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