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

Refactor tipElement to use a custom object #82

Open
stevenbenner opened this issue Jun 8, 2013 · 0 comments
Open

Refactor tipElement to use a custom object #82

stevenbenner opened this issue Jun 8, 2013 · 0 comments
Labels
Refactor Software improvements that do not add any features or correct any defects.

Comments

@stevenbenner
Copy link
Owner

The abundance of $.data() calls is starting to smell like a missing abstraction. It might be better to create a custom object with the required properties and references. Such an object would need to have all of the current $.data() variables including a reference to the jQuery/DOM element for the element.

This may have several benefits:

  • Make it easier to lint/detect coding errors when accessing properties.
  • Give JIT compilers a chance to optimize a well-known and reused object.
  • Provide a very minor decrease in the time it takes to lookup property values.
  • Define a hard coded contract for tooltip elements.
  • Eliminate most of the name-based DATA_* variables.
  • Opportunity to move hook-once code blocks to methods instead of "HasFoo" checks.

I'm not sure if this would have a positive or negative net effect on the file size of the minified code. As long as it doesn't add a significant amount of weight to the file then the readability improvement alone should justify the change.

Investigate if this is a good idea, and, if so, implement it.

@stevenbenner stevenbenner removed this from the 1.3.1 milestone Mar 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Software improvements that do not add any features or correct any defects.
Projects
None yet
Development

No branches or pull requests

1 participant