Skip to content

Commit

Permalink
fix(runtime): remove the style property when the value is an empty st…
Browse files Browse the repository at this point in the history
…ring

NervJS#14463
  • Loading branch information
TheKonka authored and Chen-jj committed Sep 26, 2023
1 parent 846ad8e commit bdc89a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/taro-runtime/src/dom/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function setStyle (this: Style, newVal: string, styleKey: string) {

!this._pending && recordCss(this)

if (isNull(newVal) || isUndefined(newVal)) {
if (isNull(newVal) || isUndefined(newVal) || newVal === '') {
this._usedStyleProp.delete(styleKey)
delete this._value[styleKey]
} else {
Expand All @@ -52,7 +52,7 @@ function initStyle (ctor: typeof Style, styleProperties: string[]) {

for (let i = 0; i < styleProperties.length; i++) {
const styleKey = styleProperties[i]

if (ctor[styleKey]) return

properties[styleKey] = {
Expand Down Expand Up @@ -194,7 +194,7 @@ initStyle(Style, styleProperties)

hooks.tap('injectNewStyleProperties', (newStyleProperties: string[]) => {
if (isArray(newStyleProperties)) {
initStyle(Style, newStyleProperties)
initStyle(Style, newStyleProperties)
} else {
if (typeof newStyleProperties !== 'string') return

Expand Down

0 comments on commit bdc89a5

Please sign in to comment.