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

Remove Deprecations for jQuery 3.5 #45

Open
DenisLabrecque opened this issue Jun 26, 2020 · 2 comments
Open

Remove Deprecations for jQuery 3.5 #45

DenisLabrecque opened this issue Jun 26, 2020 · 2 comments

Comments

@DenisLabrecque
Copy link

Using jQuery migrate 3.3 and jQuery 3.5 shows the following deprecations:

JQMIGRATE: Use of number-typed values is deprecated in jQuery.fn.css
JQMIGRATE: jQuery.fn.resize() event shorthand is deprecated

This is related to adding styles to $.css() that don't have a unit after the width or height (CSS requires defined units, which can be in %, em, px, vw, vh, etc.)

There may be other issues as well, but this is the one currently highlighted on our site.

@DenisLabrecque
Copy link
Author

DenisLabrecque commented Jun 26, 2020

Here is the corrected bit for number-typed values:

  var defaultDropdownStylesFunction = function($this) {
    var config = $this.data('swiftype-config-autocomplete');
    var $attachEl = config.attachTo ? $(config.attachTo) : $this;
    var offset = $attachEl.offset();
    var styles = {
      'position': 'absolute',
      'z-index': '9999',
      'top': offset.top + $attachEl.outerHeight() + 1 + 'px',
      'left': offset.left + 'px'
    };
    if (config.setWidth) {
      styles['width'] = $attachEl.outerWidth() - 2 + 'px';
    }
    return styles;
  };

@yakhinvadim yakhinvadim transferred this issue from swiftype/swiftype-search-jquery Jun 26, 2020
@yakhinvadim
Copy link

Hey Denis. Thanks for opening an issue and suggesting a fix.

Given that more and more people are moving away from jQuery, we're working on a replacement for this plugin. Meanwhile, we are limiting the scope of support for this plugin to critical bug fixes and security fixes.

I'll leave the issue open for some time so other users could copy your solution to fix the warnings.

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

No branches or pull requests

2 participants