you-dont-need-jquery icon indicating copy to clipboard operation
you-dont-need-jquery copied to clipboard

replacement of document.ready

Open wizardforcel opened this issue 8 years ago • 3 comments

DOMContentLoaded has been added in HTML5. So:

jQuery:

$(() => {
    //...
});

Modern:

// HTML5
document.addeventListener('DOMContentLoaded', () => {
    //...
});

// HTML4
document.onreadystatechange = function() {
    if(document.readyState == 'complete') {
        //...
    }
};

wizardforcel avatar Mar 08 '16 07:03 wizardforcel

:+1:

maniator avatar Mar 21 '16 14:03 maniator

I will definitely get around to adding this in soon. Thanks.

ndugger avatar Mar 23 '16 14:03 ndugger

In fact, there is also a replacement in HTML 4. I've updated it.

wizardforcel avatar Oct 27 '16 02:10 wizardforcel