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
compareDocumentPositionmethod contributed in PR #488. In detail:
parentChainmethod and replaces it with a parent chain computation that immediately compares target nodes, thus avoiding unnecessary computations.pushandreverseinstead ofunshiftto assemble chains as this is considerably faster.