Download & Extend

Views UI breaks with jQuery 1.8

Project:Views
Version:7.x-3.x-dev
Component:Code
Category:bug report
Priority:major
Assigned:drumm
Status:closed (fixed)
Issue tags:da-drupalcon, portland2013

Issue Summary

When hovering links in the Views UI with 1.8 enabled, I get this error:

Uncaught Error: Syntax error, unrecognized expression: #views-display-menu-tabs.not(.views-ui-render-add-view-button-processed-processed) li.add

which in turn breaks the modals in Views so the UI becomes useless. Going back to 1.7 works around the problem.

Comments

#1

Might have to do with 1.8's new Sizzle selectors. I tried finding the JS in Views to see if some code needed to be reworked, but didn't find anything. Per this issue #1494860: Views Rewrite Results UI Broken using JQuery 1.7 perhaps the issue lies with CTools?

#2

Well in the previous dev release, with just replacing the version numbers (inside the module's google cdn path settings) to the latest jquery and jquery ui, everything worked fine. So might be a clue somewhere in that?

#3

Version:7.x-2.x-dev» 7.x-2.3-alpha1
Assigned to:Anonymous» michaelgc

I'm also getting this error, even after I forced the .module file to use jQuery UI 1.8.23 instead of 1.8.11, and cleared all site/view caches. Could be CTools-related.

#4

I found a fix that worked for me.

in views/js/views-admin.js line 261 replace

$('li.add', $menu)
with
$($menu.get(0)).find('li.add')

There might be better ways to do it, but I don't have the time to do more about it now.
The problem seems to be an incompatibility with jQuery.once and the new Sizzle (just speculating because I know nothing of it)

Changing the version number for jQuery UI fixed another problem for me in Views UI regarding the function curCSS.

#5

Status:active» needs review

I created a patch for the views module including changes by lobsterJonn.
Can someone test to see if after this change views still works with default drupal 7 jquery version? If it does maybe we can push this change to the views issue queue.

AttachmentSizeStatusTest resultOperations
views-update_to_jquery_18-1802198-6689452.patch831 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch views-update_to_jquery_18-1802198-6689452.patch. Unable to apply patch. See the log in the details link for more information.View details

#6

I just tested this. manually patched to the green prod version of views. The modal windows are still horked and the console says:

Timestamp: 11/6/12 5:02:23 PM
Error: Error: Syntax error, unrecognized expression: #views-display-menu-tabs.not(.views-ui-render-add-view-button-processed-processed) li.add
Source File: http://sandbox/sites/all/modules/jquery_update/replace/jquery/1.8/jquery... 2

jQuery Update to 1.8.2

#7

Status:needs review» needs work

I've tested this more since I posted the patch. Does not fully work with jQuery 1.8. It appears the JSON being returned is not being parsed.

#8

Version:7.x-2.3-alpha1» 7.x-2.x-dev

I got same error on dev version of module.

#9

The same

#10

Same, views UI is broken ith jquery 1.7 or 1.8, for example when you check a checkbox, it does not display additionnal options.

The dev version become quite old, is it still maintained ?

#11

Same problem....

#12

#13

Project:jQuery Update» Views
Version:7.x-2.x-dev» 7.x-3.5
Assigned to:michaelgc» Anonymous

Moving this issue to Views, as this isn't an issue with the jquery_update project's code.

#14

Title:Views UI breaks with jQuery 1.8 (unrecognized expression: #views-display-menu-tabs.not)» Views UI breaks with jQuery 1.8
Version:7.x-3.5» 7.x-3.x-dev
Priority:normal» major
Status:needs work» active

Any update?

I am getting plain ajax response displayed in browser when submitting form in Views admin UI

#15

me too. :-( Same with jQuery 1.7.
Had to revert to 1.5 ...

#16

http://drupal.org/node/1802198#comment-6915294 seems to be an okay workaround. You could even use admin/structure/views as path to be more detailed.

#17

I am getting plain ajax response displayed in browser when submitting form in Views admin UI

Please be aware that in order to fix this bug you'll need to also apply #1847900: Update jQuery UI to 1.8.24, since the version of jQuery UI shipped with the jQuery Update module is incompatible with jQuery. If you apply both, it should work fine.

#18

@smk-ka

Thank you

#19

Status:active» needs review

Double confirm with latest jquery_update in 1.8 + UI patch for 1.10 + views 7.x-3.x-dev, apply patch from #5 can solve the error message which figure out from Firebug.

Patch recreate by following commands:

git format-patch drupal/7.x-3.x -M -C -s --keep-subject --stdout > ~/views-ui_break_with_jq1.8-1802198-19.patch
AttachmentSizeStatusTest resultOperations
views-ui_break_with_jq1.8-1802198-19.patch1.08 KBIdlePASSED: [[SimpleTest]]: [MySQL] 1,627 pass(es).View details

#20

Did you tested it also without jquery 1.8?

#21

Tested with jquery_update disabled, no error reported from Firebug ;-)

#22

The latest dev version of jQuery Update has a workaround for issues like this, allowing you to choose a different version of jQuery for admin pages than for your frontend.

It doesn't solve the problem, per se, but it could save you from having to patch Views until there's a new commit.

#23

I know jquery_update put in a solution for this, which does temporarily "fix" this problem. But ultimately I don't want to have to choose an outdated version of jQuery for admin just because it breaks Views. Views needs to be patched to work with jQuery 1.8.

#24

.live() is deprecated in jQuery 1.8, so we should go ahead and replace it with .delegate(), which was added in jQuery 1.4.2. Drupal 7.21 has jQuery 1.4.4.

I've tested the attached patch with jQuery 1.8.2, as installed by jquery_update. As far as I know, what to test for is

  1. Click +Add in the Displays area.
  2. A menu of display types should pop down.
  3. It should close if the mouse leaves the add button and that menu.
AttachmentSizeStatusTest resultOperations
1802198.patch961 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 1,627 pass(es).View details

#25

Assigned to:Anonymous» drumm

#26

(Adding a couple tags since we ran into this on the portland2013.drupal.org. I've deployed #24 there, see #1946282: Admin view of DrupalCon Portland being horribly buggy and disobedient .)

#27

Status:needs review» fixed

I still try to figure out why jquery changes it's APIs so often :)
Delegate is a really nice way to solve it! Thanks.

Committed and pushed to 7.x-3.x

#28

Status:fixed» closed (fixed)

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