-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add grid option enableHtmlRendering
to use pure HTML not string
#894
Conversation
cypress/e2e/example4-model-esm.cy.ts
Outdated
@@ -21,6 +22,15 @@ describe('Example 4 - Model (ESM)', () => { | |||
.each(($child, index) => expect($child.text()).to.eq(titles[index])); | |||
}); | |||
|
|||
it('should expect first row to include "Task 0" and other specific properties', () => { | |||
cy.get(`[style="top:${GRID_ROW_HEIGHT * 0}px"] > .slick-cell:nth(1)`).should('contain', 'Task 0'); | |||
cy.get(`[style="top:${GRID_ROW_HEIGHT * 0}px"] > .slick-cell:nth(2)`).should('contain', '5 days'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have done a few changes in these files its simply adding a space between top: and the value and added ; at the end since this is what the default handling comes with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I saw that, the test will probably fail after merging your code into my branch, so I can review them afterward. Thanks for the info
- prior to this PR, SlickGrid only used html string that are then passed to `innerHTML` but that is not CSP (Content Security Policy) friendly, what could be nice is to provide an HTMLElement directly as Formatter and other areas of the code. The `enableHtmlRendering` option is basically to disable the use of `innerHTML` within SlickGrid - this PR is NOT complete, at this point it only adds HTMLElement to Formatter but there are still some usage of `innerHTML` in the code
8d4bcd6
to
a683ab9
Compare
innerHTML
but that is not CSP (Content Security Policy) friendly, what could be nice is to provide an HTMLElement directly as Formatter and other areas of the code.innerHTML
within SlickGrid by using this newenableHtmlRendering
grid option which would fix CSP unsafe issues.innerHTML
elsewhere in the code.subject covered by this PR
HTMLElement
name
using pureHTMLElement
subject NOT covered yet by this PR
innerHTML
inside methods likeappendCellHtml
andappendRowHtml
new Function
to cache certain rows, but CSP is not happy with it unless we useunsafe-eval
which is very loose.nonce
as described in this SOExample
prior to this PR, a Formatter would always return a string, even for HTML, like below
but now with this PR, we can now use pure HTML Element directly in Formatters dropping the need for
innerHTML
internally