ember.js icon indicating copy to clipboard operation
ember.js copied to clipboard

Malformed HTML Entities in Ember Templates

Open ben-crowhurst opened this issue 1 year ago • 4 comments

🐞 Describe the Bug

Ember (Handlebars?) fails to parse HTML entities, inserting unknown character code symbols <?>.

🔬 Minimal Reproduction

Create a new handlebars template with the four following anchor elements:

/* Fail */
<a class="close" href="#" {{on "click" @hide}}>&times;</a>

/* Pass */
<a {{on "click" @hide}} class="close" href="#">&times;</a>
<a class="close" href="#" {{on "click" @hide}}> &times; </a>
<a class="close" href="#" {{on "click" @hide}}>&times;&times;</a>

😕 Actual Behavior

Unknown character code symbols appear in the browser where the HTML entity should be presented.

🤔 Expected Behavior

Given &times; Then I should see ×

🌍 Environment

  • Ember: - 5.10
  • Ember-CLI: - 5.10.0
  • Node.js/npm: - 22.7.0
  • OS: - GNU/Linux 6.8.0-76060800daily20240311-generic PopOS 22.04.
  • Browser: - Firefox 128.0 (64-bit).

ben-crowhurst avatar Aug 29 '24 12:08 ben-crowhurst

This is actually a node issue. Can you downgrade to 22.6 or earlier?

NullVoxPopuli avatar Aug 29 '24 14:08 NullVoxPopuli

Oh! that really intrigues me. Do you have a Node issue I can dive deeper into? I'd love to understand the cause.

Yes, we can downgrade, thanks.

We chose to move the on-click handler to the front of the element and made a doco reference locally.

ben-crowhurst avatar Aug 29 '24 14:08 ben-crowhurst

  • https://github.com/nodejs/node/issues/54521
  • https://github.com/nodejs/node/issues/54628
  • https://github.com/nodejs/node/issues/54543
  • https://github.com/nodejs/node/issues/54518

NullVoxPopuli avatar Aug 29 '24 15:08 NullVoxPopuli

Happy to close this issue as an upstream vendor offender.

ben-crowhurst avatar Aug 29 '24 16:08 ben-crowhurst