Error: [Exception... "'Syntax error, unrecognized expression: [@type="checkbox"]' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "" data: no]

@type="checkbox" is not a normal js thing?

This is in betterselect.js >

Drupal.behaviors.initBetterSelect = function(context) {
  $('.better-select .form-checkboxes input[@type="checkbox"]').click(function(){
    this.checked ? $(this).parent().parent().addClass('hilight') : $(this).parent().parent().removeClass('hilight');
  }).filter(":checked").parent().parent().addClass('hilight');
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kenorb’s picture

kenorb’s picture

Try input:checked instead of input[@type=checkbox]

markabur’s picture

yes, related to installing the jquery update module.

what works for me is input[type=checkbox] instead of input[@type=checkbox] -- which makes sense as the former is the correct css syntax. i guess jquery is pickier than it used to be.

recrit’s picture

Status: Active » Needs review
FileSize
616 bytes

thank you markabur! this fixed the issue I was having.

created a simple patch to change the js file

wanjee’s picture

Patch #4 is also the fix that worked for us.

Would it be applied to final 5.x ?

mdeltito’s picture

to be proper, the jQuery syntax is:

input[type="checkbox"]

xpath selectors are deprecated in jQuery >= 1.3.1

recrit’s picture

@mdeltito that is exactly what the #4 patch accomplishes.

-  $('.better-select .form-checkboxes input[@type="checkbox"]').click(function(){
+  $('.better-select .form-checkboxes input[type="checkbox"]').click(function(){
tuffnatty’s picture

input:checkbox looks better to me but this also works.

mdeltito’s picture

my understanding is that colon (:) selectors are marginally slower than the explicit [attr="val"] selector

kmonty’s picture

Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community

#4 works great.

kmonty’s picture

Title: Breaks node edit page! » Note compatible with Jquery Update -- Breaks node edit page!
kmonty’s picture

Title: Note compatible with Jquery Update -- Breaks node edit page! » Not compatible with Jquery Update -- Breaks node edit page!

whoops

budda’s picture

Works well. Release time? :-)

kmonty’s picture

From http://api.jquery.com/category/selectors/attribute-selectors/

Note: In jQuery 1.3 [@attr] style selectors were removed (they were previously deprecated in jQuery 1.2). Simply remove the ‘@’ symbol from your selectors in order to make them work again.

clashar’s picture

subscribe

benoit.borrel’s picture

subscribe++

gonzgonz’s picture

Subscribing, please :)

rhymeswithcamera’s picture

I just installed Better Select yesterday. I am running jQuery 1.3 and can confirm that all is well. [I had to install jQuery Update awhile back to work with Modal Frame API.]

Bartezz’s picture

Tested changes as mentioned in #4 which solves problems with jquery_update module.
Patch didn't work for me so created new patch based on latest 6.x-1.0-beta2

Cheers

Alex Andrascu’s picture

Yep. Patch's good. Subscribing

robcarr’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
561 bytes

I've just tried latest DEV (25 Feb 11) and it breaks with jQuery Update - specifically wysiwyg/tinymce, lightbox2 and text autocomplete in CCK fails on the node edit form. Removal of the '@' symbol in betterselect.js (as discussed by @kmonty in #14) and all is fine again.

** edit - Vertical tabs also breaking without the '@' removal. This issue maybe the problem at #429668: Clash with Vertical Tabs Module

Roll patch against DEV

markabur’s picture

Status: Needs review » Reviewed & tested by the community

Latest patch applies cleanly to 6.x-1.x-dev and solves the problem, thanks for the reroll.

dgsiegel’s picture

subscribing

simon.mittelberger’s picture

Version: 6.x-1.x-dev » 6.x-1.0-beta2

works for 6.x-1.x-beta2, thanks

markabur’s picture

Version: 6.x-1.0-beta2 » 6.x-1.x-dev

Patches go against -dev

univate’s picture

patch in #21 fixed for me.

TimelessDomain’s picture

#21 works - lets get this committed

stoatoffear’s picture

#3 works for me.

upupax’s picture

Patch #4 works for me.

artis’s picture

Issue tags: +Quick fix

This bug broke a lot of js on our clients site and took nearly an hour of work to track down and fix.

Please commit this to a new release!

Thanks.

kenorb’s picture

+1 for commit

ipwa’s picture

I will test this patch but it looks like for most people lots working correctly. If more people test the patch it'd be great, I can ask the maintainer to give add me as a temporary co-maintainer to commit this and make a new dev release.

robcarr’s picture

Its status has been RTBC for 5 months... Status settings for an issue.

markabur’s picture

Yes, this patch still works fine. I have used it in many production sites.

ressa’s picture

It works, and should be committed.

jenlampton’s picture

patch still applies, and solves the problem.

(I also noticed that the fieldset behavior in core was broken without this fix - will be great to get it in!)

ipwa’s picture

Assigned: Unassigned » ipwa

I was added as a co-maintainer. I'm on vacations, but will be back in my office next week, will commit the patch then.

jenlampton’s picture

Great, thank you! :)

ipwa’s picture

Status: Reviewed & tested by the community » Fixed

I re-confirmed the bug in a fresh Drupal 6 install, and applied the patch that solved it. Committed, thanks to everyone involved good work! People who helped with the patch where credited: http://drupal.org/commitlog/commit/6308/22e9a74251e22d61cbf976c99d3633aa...

We now have a new beta3 release :)

Bartezz’s picture

Cheers!

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix

Automatically closed -- issue fixed for 2 weeks with no activity.