Skip to content

Commit

Permalink
fix(skeleton, gradient-text): causing page error in some old browsers,
Browse files Browse the repository at this point in the history
…closes #1867
  • Loading branch information
07akioni committed Dec 19, 2021
1 parent da35e10 commit 6651d31
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- Fix `n-transfer` list doesn't follow container height when style.height is set, closes [#1879](https://github.com/TuSimple/naive-ui/issues/1879).
- Fix `n-skeleton` & `n-gradient-text` cause runtime error in some old browsers, closes [#1867](https://github.com/TuSimple/naive-ui/issues/1867).

### Feats

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- 修复 `n-transfer` 在自定义高度后内部列表和容器高度不一致,关闭 [#1879](https://github.com/TuSimple/naive-ui/issues/1879)
- 修复 `n-skeleton``n-gradient-text` 在某些较老的浏览器导致运行错误,关闭 [#1867](https://github.com/TuSimple/naive-ui/issues/1867)

### Feats

Expand Down
15 changes: 7 additions & 8 deletions src/_utils/composable/use-houdini.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { onBeforeMount } from 'vue'

let houdiniRegistered = false

export function useHoudini (): void {
onBeforeMount(() => {
if (!houdiniRegistered) {
houdiniRegistered = true
if ((window?.CSS as any)?.registerProperty) {
if (typeof window === 'undefined') return
if (!houdiniRegistered) {
houdiniRegistered = true
if ('registerProperty' in window?.CSS) {
try {
;(CSS as any).registerProperty({
name: '--color-start',
syntax: '<color>',
Expand All @@ -19,7 +18,7 @@ export function useHoudini (): void {
inherits: false,
initialValue: '#0000'
})
}
} catch (e) {}
}
})
}
}

0 comments on commit 6651d31

Please sign in to comment.