I'm getting a javascript error "class statement requires a name" when looking at /admin/content
this function is shown in the browser:
(function(e,i){'use strict';i.behaviors.views_bulk_operations={attach:function(e,t){once('vbo-init','.vbo-view-form',e).forEach(i.viewsBulkOperationsFrontUi)}};class;viewsBulkOperationsSelection{constructor(vbo_form){this.vbo_form=vbo_form;this.$actionSelect=e('select[name="action"]',vbo_form);this.view_id='';this.display_id='';this.$summary=null};bindEventHandlers($element,index){if($element.length){var t=this;$element.on('keypress',function(i){if(i.which===13){i.preventDefault();i.stopPropagation();t.update(!this.checked,index,e(this).val());e(this).trigger('click')};if(i.which===32){t.update(!this.checked,index,e(this).val())}});$element.on('click',function(i){if(i.which===1){t.update(this.checked,index,e(this).val())}})}};bindCheckboxes(){var t=this,f=e('.form-checkbox',this.vbo_form);f.on('change',function(e){t.toggleButtonsState()})};toggleButtonsState(){var r=e('.form-checkbox:checked',this.vbo_form),l=e('[id^="edit-actions"] input[type="submit"], [id^="edit-actions"] button[type="submit"]',this.vbo_form),v=e('.vbo-info-list-wrapper li',this.vbo_form),s=v.length||r.length;if(this.$actionSelect.length){var d=s&&this.$actionSelect.val()!=='';l.prop('disabled',!d)}
Drupal 9.4.6 with PHP 7.4
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | vbo_javascript-syntax-error-3311881-9.patch | 471 bytes | jeslin.shaji |
Comments
Comment #2
graber commentedPlease provide steps to reproduce.
Comment #3
drupaldope commentedI didn't do anything special, except update VBO to the latest version (using composer).
The problem went away when I downgraded back to 4.1.3
Happy to provide any further info you require.
Comment #4
graber commentedComment #5
drupaldope commented1. it happens on Firefox's and Chrome's newest version
2. the error occurs on the page /admin/content as described. the buttons on the right of the content (edit,duplicate,etc.) are not rendered properly
3. I first tested with core aggregation turned off. the buttons were rendered properly, but an error "Uncaught SyntaxError: Unexpected token ';' " appeared.
then I tested with both core aggregation and advagg off, and there was no error.
the error disappears when advagg is off.
Comment #6
graber commentedInteresting. Can you create an issue on advagg module? Let's hope its maintainers will be able to provide some more information on how can we solve this.
Comment #7
graber commentedI don't use advagg, but try something like
with a semicolon after the class closing "}" instead, maybe advagg will not break it.
If it'll work patch welcome.
Comment #8
drupaldope commentedI'm still trying to nail the error, I also spotted this in my php error log, maybe it's related ?
Comment #9
jeslin.shaji commentedI upgraded the module from 4.1.4 to 4.2.0 and got an error similar to #5 - "Uncaught SyntaxError: Unexpected token ';' "
I am also using advagg.
Adding a patch as mentioned by @Graber. This fixed the issue for me.
Comment #10
jeslin.shaji commentedComment #11
graber commentedNice, thank you 🥳
If anyone else can test this we can get this to the next release.
Also created this issue in advagg, so they know class declarations are causing issues and will maybe help to find the correct approach if this is not it..
Comment #12
graber commentedComment #13
rtdean93 commentedThis patch worked for me. Core 9.4.8. PHP 8.1
Comment #14
dineshreddymathuku commented#9 patch is looks good for me core 9.4.7 Php 8.1
Thanks
Comment #15
graber commentedFixed in 4.2.x, thank you.
Comment #18
thidd commentedI think would be nice to create a release for this change.
Comment #19
graber commentedTrue, unfortunately I'm very bust currently and it's not the only thing there'll be to release. There's usually a Christmas release so I think it'll be then the latest. Santa Graber will come ;)