Side navigation
#11662 closed bug (wontfix)
Opened April 27, 2012 05:35AM UTC
Closed May 05, 2012 02:45PM UTC
Last modified May 29, 2012 09:39PM UTC
A pseudoselector created on jQuery.sub() doesn't work
Reported by: | Matthias.Melitzer | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When a jQuery pseudoselector is created the selector is available to jQuery and all following created subs using jQuery.sub().
When a pseudoselector is created on the jQuery sub object itself the selector is available when investigating the sub object but an exception is thrown when used and the function never gets called. Reason for me to find this behavior is using RequireJS with the widget factory and creating plugins on the sub object, the automatically created selectors don't work on either jQuery object.
Attachments (0)
Change History (8)
Changed April 27, 2012 05:48AM UTC by comment:1
Changed April 27, 2012 10:05PM UTC by comment:2
resolution: | → invalid |
---|---|
status: | new → closed |
This is the intended behaviour.
Description: Creates a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object.
Changed April 27, 2012 11:49PM UTC by comment:3
resolution: | invalid |
---|---|
status: | closed → reopened |
The bug that Matthias is reporting is that the selector doesn't even work on the sub.
Changed April 28, 2012 01:02AM UTC by comment:4
The reason is because jQuery.expr
(née Sizzle.selectors
) is cached in a closure variable named Expr
and that is what is used by both jQuery
and $sub
. As incredibly dumb as it seems, that is actually the intended behavior of jQuery.sub
-- the "sub" uses all the closure variables of its source.
Our intent for 1.8 is to deprecate jQuery.sub
for removal to a plugin in 1.9, so I am inclined to close this wontfix and frantically wave everyone away from using it.
Changed May 02, 2012 06:01AM UTC by comment:5
I stumbled across this bug when trying to modularize our JS using RequireJS. To keep plugins 'private' to modules where they're required i've been using sub and as the UI Widget Factory creates a pseudoselector out of the box i couldn't use it even it's there when looking at $sub.expr[':'].
As a cross-reference: https://forum.jquery.com/topic/keeping-plugins-to-yourself-with-requirejs
Changed May 05, 2012 02:45PM UTC by comment:6
resolution: | → wontfix |
---|---|
status: | reopened → closed |
I'm closing this wontfix for the reasons given above. It's really inherent in the design of jQuery.sub
.
Changed May 29, 2012 12:05PM UTC by comment:7
@dmethvin, should I bring newInstance back from the deads so that we can finally have a proper way to create a new instance of the lib (including attach the new instance to a new window)?
Changed May 29, 2012 09:39PM UTC by comment:8
@jaubourg, you should run newInstance by gibson042, he's got a soft spot for jQuery.sub and would like to keep it. So maybe he'll be interested in an alternative. But I still think any solution should be battle-tested as a plugin before we talk about including it.
Here's the test code on jQuery edge: http://jsfiddle.net/AkKsv/4/