Download & Extend

Not compatible with Jquery Update -- Breaks node edit page!

Project:Better Select
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:ipwa
Status:closed (fixed)
Issue tags:Quick fix

Issue Summary

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');
}

Comments

#1

#2

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

#3

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.

#4

Status:active» needs review

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

created a simple patch to change the js file

AttachmentSize
betterselect-510012_selector-fix.patch 616 bytes

#5

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

Would it be applied to final 5.x ?

#6

to be proper, the jQuery syntax is:

input[type="checkbox"]

xpath selectors are deprecated in jQuery >= 1.3.1

#7

@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(){

#8

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

#9

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

#10

Priority:normal» critical
Status:needs review» reviewed & tested by the community

#4 works great.

#11

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

#12

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

whoops

#13

Works well. Release time? :-)

#14

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.

#15

subscribe

#16

subscribe++

#17

Subscribing, please :)

#18

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.]

#19

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

AttachmentSize
jquery-update-compatibility.patch 673 bytes

#20

Yep. Patch's good. Subscribing

#21

Status:reviewed & tested by the community» needs review

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

AttachmentSize
betterselect_510012.patch 561 bytes

#22

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.

#23

subscribing

#24

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

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

#25

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

Patches go against -dev

#26

patch in #21 fixed for me.

#27

#21 works - lets get this committed

#28

#3 works for me.

#29

Patch #4 works for me.

#30

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.

#31

+1 for commit

#32

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.

#33

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

#34

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

#35

It works, and should be committed.

#36

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!)

#37

Assigned to:Anonymous» 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.

#38

Great, thank you! :)

#39

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 :)

#40

Cheers!

#41

Status:fixed» closed (fixed)

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

nobody click here