diff --git a/_site/heti-addon.js b/_site/heti-addon.js index dc7d84c..03d53bf 100644 --- a/_site/heti-addon.js +++ b/_site/heti-addon.js @@ -767,13 +767,15 @@ } 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); } } diff --git a/_site/heti.css b/_site/heti.css index f13afed..b237809 100644 --- a/_site/heti.css +++ b/_site/heti.css @@ -216,10 +216,6 @@ clear: both; } -.heti:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)), .heti:not(:lang(zh)) { - letter-spacing: 0; -} - .heti > *:first-child, .heti section > *:first-child, .heti td > *:first-child { @@ -332,6 +328,22 @@ color: inherit; } +.heti:not(:lang(zh)):not(:lang(ja)):not(:lang(kr)), .heti:not(:lang(zh)) { + letter-spacing: 0; +} + +.heti a, +.heti abbr, +.heti code, +.heti heti-spacing, +.heti [lang="en-US"] { + /* + There should be no leeter-spacing between + English characters. + */ + letter-spacing: normal; +} + .heti h1, .heti h2, .heti h3, diff --git a/lib/_base.scss b/lib/_base.scss index ff8e979..e70ada0 100644 --- a/lib/_base.scss +++ b/lib/_base.scss @@ -6,13 +6,6 @@ // 清容器浮动 @include clear-float(); - // 非中文时不加间距 - letter-spacing: $letter-spacing-medium; - @include non-cjk-block { - letter-spacing: $letter-spacing-normal; - - } - // 清容器内首尾元素外边距 &, section, @@ -113,4 +106,23 @@ } } } + + // 非中文时不加间距 + letter-spacing: $letter-spacing-medium; + @include non-cjk-block { + letter-spacing: $letter-spacing-normal; + + } + + a, + abbr, + code, + heti-spacing, + [lang="en-US"] { + /* + There should be no leeter-spacing between + English characters. + */ + letter-spacing: normal; + } }