Skip to content

Commit

Permalink
fix(Web client): Respect attribute aliases for Add operations
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome committed Dec 6, 2021
1 parent 88bd9ca commit 5523797
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion web/src/patches/dom/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
panic,
} from '../checks'
import { applyAdd as applyAddString } from '../string'
import { STRUCT_ATTRIBUTES } from './consts'
import { STRUCT_ATTRIBUTES, STRUCT_ATTRIBUTE_ALIASES } from './consts'
import { escapeAttr, unescapeAttr, unescapeHtml } from './escape'
import { createFragment, resolveParent } from './resolve'

Expand Down Expand Up @@ -57,6 +57,13 @@ export function applyAddStruct(
return
}

// Is the slot represented by an attribute with a different name?
const alias = STRUCT_ATTRIBUTE_ALIASES[name]
if (alias !== undefined) {
struct.setAttribute(alias, escapeAttr(html))
return
}

// Is there a placeholder child element for the property ? If so update it's content.
const placeholder = struct.querySelector(`[data-itemprop="${name}"]`)
if (placeholder) {
Expand Down

0 comments on commit 5523797

Please sign in to comment.