olifolkerd / tabulator

Interactive Tables and Data Grids for JavaScript
http://tabulator.info
MIT License
6.78k stars 821 forks source link

HTML attributes in a formatter get converted to lowercase #4524

Closed alxcost closed 4 months ago

alxcost commented 5 months ago

Describe the bug When using a formatter that returns HTML code with case-sensitive attributes, all attributes seem to be converted to lowercase in the rendered result.

Tabulator Info

Working Example https://jsfiddle.net/zwph2sqf/

To Reproduce

  1. Provided HTML is <svg cIcon MyCaseSensitiveAttribute class="me-2" name="cilCloudUpload"></svg>
  2. But rendered result becomes <svg cicon="" mycasesensitiveattribute="" class="me-2" name="cilCloudUpload"></svg>

Expected behavior HTML should be rendered as <svg cIcon MyCaseSensitiveAttribute class="me-2" name="cilCloudUpload"></svg> but all attributes (but not their values) seem to be converted to lowercase.

Use case is the Core UI library which uses case-sensitive attributes to instantiate their components: https://coreui.io/angular/docs/icons/

sthkn commented 5 months ago

All HTML attributes are converted to lowercase - it's an HTML feature, not unique to tabulator - see here: https://html.spec.whatwg.org/multipage/dom.html#custom-data-attribute Here's an example with no javascript usage: https://jsfiddle.net/dm79vu3o/

I'm not an angular developer, so I'm not sure how to get it to work right, but "cIcon" is an Angular directive, not an HTML attribute. As I understand it, The CoreUI library is for angular, which will take part in the rendering of the DOM. Tabulator will take part after the DOM has been rendered. If you modify the DOM after it is rendered, then Angular wouldn't know about the svg element added, and thus wouldn't see the cIcon (IF you were able to set it as a case-sensitive attribute).