Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New arch 1st step: add a plugin name #124

Merged
merged 3 commits into from
Nov 20, 2015

Conversation

Indigo744
Copy link
Collaborator

This is a first step to the new architecture (see #117).

It adds:

  • a variable containing the plugin name "mapael"
  • a check against multiple instanciation (and throw error if trying to instanciate multiple time)
  • allow external access to current instance on element through $.data()
  • a class mapael to the element on which mapael is defined

It removes:

  • the return statement that was useless

@@ -55,6 +64,9 @@
, zoomCenterX = 0
, zoomCenterY = 0
, previousPinchDist = 0;

// add plugin class name on element
$self.addClass(pluginName);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of adding the plugin name as a class name on the element ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows the plugin to be deterministic:

  • declaring externally that mapael is assigned to this element
  • allow specific CSS customization aimed at mapael (without fearing name collision)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About the second point, we will be able to define the CSS for mapael.
Example: the .tooltip class. There is high chance this name is already used on a website, or through a framework, with different parameters.
Hence, using .mapael .tooltip will allow specific selectivity.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,

Thank for the explanation, it's ok for me. However, regarding the second argument, currently, nothing prevent the user from adding a custom class name on the container in order to allow specific selectivity in the CSS, this is why I was curious about the purpose of the class.

@neveldo neveldo merged commit 079a7f3 into neveldo:master Nov 20, 2015
@Indigo744 Indigo744 deleted the Indigo744-patch-newarch-pluginname branch November 20, 2015 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants