-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Closed
Description
I think this must be a bug of jQuery, a simple custom property/function definition on Object.prototype is just normal (and fairly common). That kind of action should not trigger any bug in any framework. But here it does cause a bug in the jQuery when we use addBack with filter (selector).
So here what I've done before detecting the issue:
//define a simple dummy random property like this (before loading and running the jQuery code)
Object.prototype.xyzxxx = "";
$(function(){
//just try a query with .addBack with selector
$("div").addBack("div");
});
Here is the error printed in the console:
Uncaught TypeError: G[o].exec is not a function
at se.tokenize (jquery-3.5.1.min.js:2)
at se.compile (jquery-3.5.1.min.js:2)
at se.select (jquery-3.5.1.min.js:2)
at se (jquery-3.5.1.min.js:2)
at Function.se.matches (jquery-3.5.1.min.js:2)
at Function.S.filter (jquery-3.5.1.min.js:2)
at D (jquery-3.5.1.min.js:2)
at S.fn.init.filter (jquery-3.5.1.min.js:2)
at S.fn.init.addBack (jquery-3.5.1.min.js:2)
at HTMLDocument.<anonymous> (?editor_console=:111)
Note that the addBack without selector will not cause the error.
You can try out the fiddle here https://jsfiddle.net/v8hfmdn3/1/ for detailed error info.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels