emberjs / emberjs/ember.js

[Bug] can not dynamically assign prefix attribute in templates

Open
#19,369 6 comments 0 reactions 0 assignees View on GitHub
Has Reproduction
Dominant language
TypeScript
Stars
22.6k
Forks
4.2k
Avg merge
3d 12h
Merged PRs (30d)
15

Description

### 🐞 Describe the Bug
In our application we're working with [rdfa](https://www.w3.org/TR/rdfa-core/) annotations. When we try to assign the `prefix` attribute on an element, this raises a runtime error in emberjs. This happens both in glimmer components as in regular routes with a controller and template.

### 🔬 Minimal Reproduction
The following is a very basic example using a controller and a template
https://gist.github.com/nvdk/9bd783bf8e5a55170ceb4a61887d3d67
https://ember-twiddle.com/9bd783bf8e5a55170ceb4a61887d3d67

### 😕 Actual Behavior
Runtime error:
```
Uncaught TypeError: setting getter-only property "prefix"
Ember 29
__setProperty
set
setDynamicAttribute

evaluate
evaluateSyscall
evaluateInner
...
```
### 🤔 Expected Behavior
The attribute is assigned just like any other attribute.

### 🌍 Environment
Tested on
- Ember: 3.20
- Node.js/npm: 12.8.4/6.10.3
- OS: ubuntu 20.04
- Browser: firefox

### ➕ Additional Context
We can work around the issue with the did-insert modifier and then setting the attribute using element.setAttribute, but would prefer just being able to assign it in the template.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.