-
Notifications
You must be signed in to change notification settings - Fork 92
perf: simplify DOM.compareDocumentPosition
#805
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
perf: simplify DOM.compareDocumentPosition
#805
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #805 +/- ##
==========================================
+ Coverage 95.06% 95.08% +0.01%
==========================================
Files 8 8
Lines 2169 2177 +8
Branches 571 571
==========================================
+ Hits 2062 2070 +8
Misses 107 107 ☔ View full report in Codecov by Sentry. |
Thx again, it even looks faster 😉 When you update the branch against the latest master branch, I can merge it. |
compareDocumentPosition
MethodDOM.compareDocumentPosition
Done. On a different note: Are you considering moving to ES modules at some point. I did a quick and dirty mockup the other day for the MathJax dev lab, where modules are imported directly from source rather than bundled, and conversion took about ten minutes. |
I'm really low on resources regarding this project currently, so I will very likely not be the person to initiate this. |
Thanks for the merge.
I know what you mean. It's not as if I had any free cycles. It would be a shame to see that project die, though, as it really is a lean and effective DOM Implementation. There are many bloated ones around... As I said quick and dirty, mostly done with a couple of |
PR contributes a more efficient coding for the
compareDocumentPosition
method contributed in PR #488. In detail:
parentChain
method and replaces it with a parent chain computation that immediately compares target nodes, thus avoiding unnecessary computations.push
andreverse
instead ofunshift
to assemble chains as this is considerably faster.