Possible modification for better code #97
Replies: 1 comment
-
|
Agreed. We should short-circuit the lookup and can have this around conditional to avoid unnecessarily DOM access. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/Progyan1997/Operational-Transformation/blob/c743cc51648d544c1a783b66e0c81dc208e0e593/packages/ace/src/tooltip-marker.ts#L52
Hey @Progyan1997 , I thought about this code here and I feel that this piece of code works for now but depends on
querySelectorto retrieve theace_contentdiv. Instead of that I think we can shift this code inside theupdatemethod and useclosestto append the tooltip marker like so :-where
_aceContentis a new property onTooltipMarkerclass. We can also not introduce this new property and instead run theclosestandappendoperation every time which will result in same behavior.What do you think ? If you would wanna go with this, would you choose introducing
_aceContentor performingclosestandappendevery time ?My intuition for this change - The reason is possible collision of same class names can break this with top to bottom existing approach. In bottom to top with
closestthe probability is very less unless user manipulates the editor DOM nodes itself.Beta Was this translation helpful? Give feedback.
All reactions