On Firefox, my masonry view is running very well, but on Chrome I get this error:
$container.once is not a function
the error is coming from line 94 of modules/masonry/js/masonry.js
$container.once('masonry').masonry($options);

Comments

DuneBL created an issue. See original summary.

dunebl’s picture

Here are more information regarding the js loaded in my page:

<script type="application/json" data-drupal-selector="drupal-settings-json">{"path":{"baseUrl":"\/","scriptPath":null,"pathPrefix":"","currentPath":"node","currentPathIsAdmin":false,"isFront":true,"currentLanguage":"fr"},"pluralDelimiter":"\u0003","masonry":{".view-all-images.view-display-id-block_all_vidimg \u003E .view-content":{"item_selector":".masonry-item","column_width":"","column_width_units":"px","gutter_width":1,"resizable":true,"animated":true,"animation_duration":500,"fit_width":false,"rtl":false,"images_first":true,"stamp":"","percent_position":false}},"bootstrap":{"forms_has_error_value_toggle":1,"modal_animation":1,"modal_backdrop":"true","modal_keyboard":1,"modal_show":1,"modal_size":"","popover_enabled":1,"popover_animation":1,"popover_container":"body","popover_content":"","popover_delay":"0","popover_html":0,"popover_placement":"right","popover_selector":"","popover_title":"","popover_trigger":"click","popover_trigger_autoclose":1,"tooltip_enabled":1,"tooltip_animation":1,"tooltip_container":"body","tooltip_delay":"0","tooltip_html":0,"tooltip_placement":"auto left","tooltip_selector":"","tooltip_trigger":"hover"},"user":{"uid":0,"permissionsHash":"4304cfb1ad26fe143f9e69bad35e60fc0d4ad37b55a52f4266ed1f0d96d04f31"}}</script>
<script src="/core/assets/vendor/domready/ready.min.js?v=1.0.8"></script>
<script src="/core/assets/vendor/jquery/jquery.min.js?v=2.2.3"></script>
<script src="/core/assets/vendor/underscore/underscore-min.js?v=1.8.3"></script>
<script src="/core/misc/drupalSettingsLoader.js?v=8.2.0-dev"></script>
<script src="/sites/mysite/files/languages/fr_DXBgOxMlmoGvWboaykN-Scy0T0_mF3uj3HxgCjYUft4.js?oaksc5"></script>
<script src="/core/misc/drupal.js?v=8.2.0-dev"></script>
<script src="/modules/search_kint/search_kint.search.js?v=1"></script>
<script src="/modules/search_kint/search_kint.trail.js?v=1"></script>
<script src="/themes/bootstrap/js/drupal.bootstrap.js?oaksc5"></script>
<script src="/themes/bootstrap/js/attributes.js?oaksc5"></script>
<script src="/themes/bootstrap/js/theme.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/affix.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/alert.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/button.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/carousel.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/collapse.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/dropdown.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/modal.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/tooltip.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/popover.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/scrollspy.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/tab.js?oaksc5"></script>
<script src="/sites/mysite/themes/progboot/bootstrap/js/transition.js?oaksc5"></script>
<script src="/themes/bootstrap/js/popover.js?oaksc5"></script>
<script src="/themes/bootstrap/js/tooltip.js?oaksc5"></script>
<script src="/modules/masonry/js/masonry.js?oaksc5"></script>
<script src="/libraries/masonry/masonry.pkgd.min.js?v="></script>
<script src="/libraries/imagesloaded/imagesloaded.pkgd.min.js?v="></script>
dunebl’s picture

Title: Chrome problem: $container.once is not a function » Permission problem?: $container.once is not a function

I have changed the title as in fact, this is not a chrome problem, this is a permission problem:

Anonymous: not working
Authenticated user: not working
Administrator: working

I will check If I need to setup some permission and I will get back to you!!

dom.’s picture

Hi !

I can't reproduce on fresh install. Can you check you are using the latest dev version of Masonry API. If so, could you check that the line:
- jquery.once
is present in the file masonry.libraries.yml
If so, can you clean your caches at /admin/config/development/performance and let me know how things goes ?!

dunebl’s picture

You are right!!! Installing latest DEV solved my problem...
Many thanks for your help, and sorry for wasting your time (I should check dev version before asking, but I was sure it was dev)...

dunebl’s picture

Status: Active » Closed (outdated)
ajayg’s picture

Status: Closed (outdated) » Active

Just tried this with latest dev version and released version on a fresh install. I am still seeing this issue.

ajayg’s picture

The culprit is core/jquery.once is again missing from masonry.libraries.yml in latest dev version. Adding it at the end of file solved the issue.

mstrelan’s picture

Title: Permission problem?: $container.once is not a function » $container.once is not a function due to missing dependency
Status: Active » Needs review
StatusFileSize
new384 bytes
markdc’s picture

#9 works. Thank you.

This problem came up for me only after I changed permissions for some unrelated footer blocks to administrator only, as well as an unrelated view.

mstrelan’s picture

@fatmarker, many other modules or themes will depend on jquery.once so it was likely already included.

ytsurk’s picture

StatusFileSize
new360 bytes

Re-Roll

ytsurk’s picture

Status: Needs review » Reviewed & tested by the community
mstrelan’s picture

Why did you re-roll that? The patch added a line break at the end of the file which you removed. I can see through your post history you're fishing for credits. Please stop.

markdc’s picture

@mstrelan Thank you for the explanation! That makes sense. I was too low on caffeine at the time to deduce that. XD

ytsurk’s picture

Exactly of that new line at the end of file it did not apply, and I wanted an official patch .. credits are yours, no problem with that ..
But I missed to put that new line again ..

  • Dom. committed bbd986c on 8.x-1.x
    Issue #2769417 by mstrelan, ytsurk: $container.once is not a function...
dom.’s picture

Status: Reviewed & tested by the community » Fixed

jquery.once was indeed a missing dependency. Thanks a lot for help.

Status: Fixed » Closed (fixed)

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