Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

sidenav's backdrop remove on destroy is incompatible with jQuery #4876

@mxab

Description

@mxab

Hi,
as of 0.11.1 every time I do a state change I get an error

TypeError: expr.replace is not a function
    at Function.Sizzle.matchesSelector (jquery.js:1439)
    at Function.jQuery.filter (jquery.js:2704)
    at jQuery.fn.extend.remove (jquery.js:5788)
    at val (angular_angular.js:1195)
    at Scope.parent.$get.Scope.$broadcast (angular_angular.js:16252)
    at Scope.parent.$get.Scope.$destroy (angular_angular.js:15864)
    at cleanupLastView (angular-ui-router.js:3914)
    at angular-ui-router.js:3961
    at publicLinkFn (angular_angular.js:7553)
    at updateView (angular-ui-router.js:3951)

After some debugging I found this

scope.$on('$destroy', angular.bind(backdrop, backdrop.remove));

But since $on callbacks get the event as first parameter jQuery's remove interprets this as an selector (see https://api.jquery.com/remove/). The error disappears when I call backdrop.remove() explicitly

scope.$on('$destroy', function(){
      backdrop.remove()
    });

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions