Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'exclude_jquery' argument #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

dgilder
Copy link

@dgilder dgilder commented May 18, 2019

Because Plack::Middleware::Debug includes an older version of jQuery and
loads into the page by replacing the closing `</body>` tag, any existing
jQuery object is replaced.  This is somewhat mitigated by using
`jQuery.noConflict();` in `toolbar.js`, but still results in
'window.jQuery' referencing the older `1.2.6` version of jQuery that is
loaded from `debug_toolbar/jquery.js`.

If jQuery plugins were added prior to `debug_toolbar/jquery.js`, then
they are no longer available under `window.jQuery` afterwards, as
`noConflict()` simply restores the reference `$` previously pointed to,
and the variable `jQuery` continues to point to the `1.2.6` version.

This can also cause problems for code executed via `$(document).ready()`
functions that reference `jQuery` (rather than `$`) when calling modern
methods that are not available in the older `1.2.6` version of jQuery.

A longer term solution would be to rewrite `toolbar.js` to remove its
dependence on jQuery, but this small change to add 'exclude_jquery'
makes it easy to work around the problem in the meantime.

David Gilder added 2 commits May 18, 2019 12:49
Because Plack::Middleware::Debug includes an older version of jQuery and
loads into the page by replacing the closing `</body>` tag, any existing
jQuery object is replaced.  This is somewhat mitigated by using
`jQuery.noConflict();` in `toolbar.js`, but still results in
'window.jQuery' referencing the older `1.2.6` version of jQuery that is
loaded from `debug_toolbar/jquery.js`.

If jQuery plugins were added prior to `debug_toolbar/jquery.js`, then
they are no longer available under `window.jQuery` afterwards, as
`noConflict()` simply restores the reference `$` previously pointed to,
and the variable `jQuery` conintues to point to the `1.2.6` version.

This can also cause problems for code executed via `$(document).ready()`
functions that reference `jQuery` (rather than `$`) when calling modern
methods that are not available in the older `1.2.6` version of jQuery.

A longer term solution would be to rewrite `toolbar.js` to remove its
dependence on jQuery, but this small change to add 'exclude_jquery'
makes it easy to work around the problem in the meantime.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant