Side navigation
#12643 closed bug (fixed)
Opened October 03, 2012 03:41PM UTC
Closed October 04, 2012 01:50PM UTC
Last modified October 13, 2012 01:53AM UTC
Upgrade from 1.3.2 to 1.8.2 gives an Uncaught TypeError
Reported by: | alainahardie@gmail.com | Owned by: | gibson042 |
---|---|---|---|
Priority: | low | Milestone: | 1.8.3 |
Component: | selector | Version: | 1.8.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi,
I just tried upgrading my app to 1.8.2 from 1.3.2. I tried 1.7.2 and saw the same thing. I get a message in the Chrome debugger that says:
Uncaught TypeError: Cannot read property 'type' of undefined jquery.min.js:2
Turns out that it was this selector that was breaking it:
jQuery('#profile-photos .photo-set-container, #profile-photos .flexed-photo-set-container,')
Notice the trailing comma?
If I remove the trailing comma like so:
jQuery('#profile-photos .photo-set-container, #profile-photos .flexed-photo-set-container')
... it works fine.
Now obviously the trailing comma is a bug, but it shouldn't kill JavaScript on the page. If the selector is null/undefined, whatever iterator is being used should ignore it, right?
Attachments (0)
Change History (5)
Changed October 03, 2012 06:03PM UTC by comment:1
Changed October 03, 2012 06:12PM UTC by comment:2
The bare JavaScript method throws an error:
So the old version was incorrect in accepting an invalid selector. I think the only question is whether this should be fixed to have jQuery (well Sizzle) throw its own "invalid selector" error rather than having an internal script error. Seems like we should do that.
Changed October 03, 2012 08:06PM UTC by comment:3
component: | unfiled → selector |
---|---|
milestone: | None → 1.8.3 |
owner: | → gibson042 |
priority: | undecided → low |
status: | new → assigned |
I just ran into this as well; a null check before getting to
leadingRelative = Expr.relative[ tokens[0].type ],
in
function matcherFromTokens( tokens ) {
would save some grief. Thanks!