Hi,

In Javascript for oa_core's space_type/section_type functionality. In Drupal.behaviors.oaCoreSpaceType function we are getting one exception:

Uncaught Error:
jquery.min.js?v=1.10.2:4 Uncaught Error: Syntax error, unrecognized expression: select:[name="field_oa_space_type[und]"](…)

The Jquery selector 'select:[name="field_oa_space_type[und]"]' is causing error and this is the cause that we can't modify the space image.

Regards,

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

d.laredo created an issue. See original summary.

d.laredo’s picture

ok, we checked that is caused by jquery versión, was set to 1.10.
We changed to 1.7 and error solved.

Jorrit’s picture

Status: Active » Needs review
FileSize
3.95 KB

The following jQuery syntax used to work:
select:[name="...."]

but in recent versions of jQuery, it no longer works. One should now use:
select[name="...."]

which also works in older versions.

The attached patch:

  1. Fixes all occurrences of the above syntax such that it is compatible with both stock jQuery (1.4.4) and newer versions.
  2. Adds .trigger('change') to a .val() to make sure that select2 detects the change.
  3. Adds support for the change in jQuery 1.6 where attr() should no longer be used to change checked, but prop().
mpotter’s picture

I think this patch looks reasonable, but I need a test procedure for it to ensure this doesn't break anything.

joseph.olstad’s picture

According to the jQuery api documentation for selecting form elements by name there is no mention (I was unable to find mention) of a trailing colon ever being part of the spec used in this way. The fact that it ever worked WITH a colon must have been due to some sort of oversight.
API spec for selecting elements by name since jQuery 1.0
https://api.jquery.com/attribute-equals-selector/
OR
API spec for selecting multiple elements by name since jQuery 1.0
https://api.jquery.com/multiple-attribute-selector/

I did a search through and could not find any reference to a trailing colon ever being part of the jQuery API. There should NOT be a trailing colon there as it was never part of the jQuery spec. If it were, I'd have probably found reference to it but I could not find it. Leading colon has a different meaning and is defined in the jQuery api, however a trailing colon is not part of the jQuery api definition , the fact that the old code ever worked was some sort of oversight and the fact that it's broken in new versions of jQuery is telling us that this needs to be changed.

Anyone else prove otherwise?

mpotter’s picture

Status: Needs review » Fixed

Committed to oa_core 2e29967.

Status: Fixed » Closed (fixed)

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