CommentFileSizeAuthor
#10 error-each-is-not-a-function.png30.16 KBlucassc

Issue fork photoswipe-3272195

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Grevil created an issue. See original summary.

kimberlly_amaral’s picture

Assigned: Unassigned » kimberlly_amaral

I'll try to work on that.

anybody’s picture

kimberlly_amaral’s picture

I made the change with the library. But this is my first issue working with jquery, if there is anything missing just tell me. I'll be glad to work on that.

lucienchalom’s picture

Assigned: kimberlly_amaral » Unassigned
Status: Active » Needs review
diegors’s picture

Issue summary: View changes

I changed the Jquery.once() by the once() function in , I hope the change is correct.

lucassc’s picture

Assigned: Unassigned » lucassc

I'll review this.

lucassc’s picture

Assigned: lucassc » Unassigned
StatusFileSize
new30.16 KB

Hi!

I reviewed and found the error below:

console logging an error that says "each is not a function"

I created a MR for fix it, please review.

gquisini’s picture

Assigned: Unassigned » gquisini

I'll review.

gquisini’s picture

Status: Needs review » Reviewed & tested by the community

I reviewed and tested it.
I did not find any JS error or warning and all photoswipe styles worked well.

gquisini’s picture

Assigned: gquisini » Unassigned
anybody’s picture

Status: Reviewed & tested by the community » Needs work

Needs reroll, furthermore I'm not really happy with the current implementation in both MR's. I don't think the once will work that way. Please provide reference to show me I'm wrong.

lucassc’s picture

Status: Needs work » Needs review

Hello @Anybody!

Thanks for reviewed. My implementation comes from here.

In line 38 of js/photoswipe.jquery.js is following the signature below:

once(id, elements (CSS selector string, Array, NodeList, jQuery), context (optional))

I also kept the $() to remain a jQuery object since it's calling .each() jQuery method.

If you still think it's better to implement this in another way, please let me know by moving the issue status to "needs work".

lucassc’s picture

Sorry for comments above, I had trouble with the reroll.

I closed my MR, reroll Diego's MR and commit there. Check it out here.

diegors’s picture

Assigned: Unassigned » diegors
grevil’s picture

I can confirm, that the changes by are correct and are working as intended!

There is a great example in the link @lucassc provided:
Before:

$('body')
  .once('vertical-tabs-fragments')
  .on();

After the new implementation:

$(once('vertical-tabs-fragments', 'body'))
  .on()

(see https://www.drupal.org/node/3158256)

Thanks all! Merging this into dev.

grevil’s picture

Assigned: diegors » Unassigned
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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