[wp-trac] [WordPress Trac] #51519: Remove use of jQuery ready()
WordPress Trac
noreply at wordpress.org
Sun Mar 21 23:36:29 UTC 2021
#51519: Remove use of jQuery ready()
--------------------------+-------------------------
Reporter: wpnomad | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.8
Component: General | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: javascript
--------------------------+-------------------------
Comment (by peterwilsoncc):
Replying to [comment:4 SergeyBiryukov]:
> These may be harder to remove, as the themes must remain compatible with
older WP versions they were released in, and possibly one or two versions
before that.
The `jQuery( callback )` technique was
[https://api.jquery.com/jQuery/#jQuery3 added in jQuery 1.0] prior to
WordPress's introduction of jQuery 1.1 in [4904] so I think removing the
`jQuery( document ).ready()` statement on the older themes should be fine.
If I am missing something then the older themes may be able to use
something along the lines of:
{{{#!js
if ( document.readyState !== 'loading' ) {
readyCallback();
} else {
window.addEventListener( 'DOMContentLoaded', readyCallback, false
);
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51519#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list