Skip to content

Commit

Permalink
Merge pull request sivan#92 from hyrious/master
Browse files Browse the repository at this point in the history
允许 `autoSpacing` 在 DOM ready 后调用
  • Loading branch information
sivan authored Jun 20, 2022
2 parents eadee6a + c82e86b commit 8fab685
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/heti-addon.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ class Heti {
}

autoSpacing () {
document.addEventListener('DOMContentLoaded', () => {
const callback = () => {
const $$rootList = document.querySelectorAll(this.rootSelector)

for (let $$root of $$rootList) {
this.spacingElement($$root)
}
})
}
if (document.readyState === 'complete') setTimeout(callback)
else document.addEventListener('DOMContentLoaded', callback)
}
}

Expand Down

0 comments on commit 8fab685

Please sign in to comment.