BernhardBaumrock / FieldtypeRockGrid

8 stars 0 forks source link

ag-Grid 19.1.1 sanitizes HTML in headers, causing slight breakage #2

Open mestaritonttu opened 5 years ago

mestaritonttu commented 5 years ago

If you have a column without an explicitly set .headerName, starting from ag-Grid 19.1.1 it displays as <span title="myColumn">myColumn</span>

The commit that caused this is https://github.com/ag-grid/ag-grid/commit/3293b322a08e18a0fca148941a6b5610fe6a41df

The thing needing rework in RockGrid.js is https://github.com/BernhardBaumrock/FieldtypeRockGrid/blob/26574e153a04660a85b758c5b9b616372c89df73/RockGrid.js#L266

BernhardBaumrock commented 5 years ago

Hi @mestaritonttu thx for your report. could you please elaborate a little bit more what the problem is. RockGrid is using version 19.0.0 at the moment, so it should not be an issue.

If you have a suggestion for a fix I'd be thankful for a PR as I'm really busy currently.

mestaritonttu commented 5 years ago

I know RG is using 19.0.0, but I wanted to warn you about the upcoming breakage :) To be clear, I verified that the commit I referenced causes the problem.

The problem is that the sanitizer makes the HTML plain text. You don't get a span element in the DOM, you get literally the markup shown in the column header. Looks like the icon will get the same bad treatment.

I don't have a suggestion off-hand. The fix would have to

1) solve the hover text in a different way 2) solve the icon insertion in a different way

BernhardBaumrock commented 5 years ago

Ok thanks! I hope I'll remember to take care of this when i upgrade aggrid...