You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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:
DATA_*
variables.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.
The text was updated successfully, but these errors were encountered: