question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JQuery namespaces not working

See original GitHub issue

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • Framework7 Version: 1.5.4

  • Platform and Target: Browser

  • Live Link or JSFiddle/Codepen: _

What you did

Inside the page:init I defined this event,

$$('body').on('click.roomtype', '.elem', function () { console.log('elem clicked'); var classes = $$(this).attr('class').split(' '); var id = classes[1]; console.log(id); });

Expected Behavior

I have a list block generated with Template7, and a click on one of those elements should trigger the click event and log its id.

Actual Behavior

No click event is triggered. If I remove the namespace ( .roomtype) it will work, but will also add multiple calls to that click. I can use .off() to stop this last behaviour, but it would require namespacing to work with anonymous functions (note: Anonymous functions are a must).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ZanderBrowncommented, Apr 3, 2017

OnPageInit should receive a page object with includes a container property. Handlers ect should be attached to that not body (thus effecting only that one page)

0reactions
lock[bot]commented, Jun 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event namespace is not showing with jquery - Stack Overflow
I check the behavior of the code, it is successful. Im only confused that I can't find the variable "namespace". Maybe the jquery...
Read more >
event.namespace | jQuery API Documentation
namespace Returns: String. Description: The namespace specified when the event was triggered.
Read more >
Namespace: apex - JSDoc
This namespace property holds the jQuery function that APEX uses. Ideally there is just one copy of jQuery on a page but it...
Read more >
jQuery event.namespace Property - GeeksforGeeks
The jQuery event.namespace property is used to return the custom namespace whenever the event is triggered. It is used to handle tasks ...
Read more >
Nested Namespacing Plug-in Pattern - O'Reilly
As a good citizen of the global namespace, we must also do our best not to prevent other developers scripts from executing because...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found