I’m looking for a workaround for a notebook that uses setHTML, which is not supported in Firefox latest.
The notebook creates a simple HTML table from data using tableify (an NPM package), then sets the table content editable. I could avoid DOM manipulation with setHTML altogether by using a stdlib Inputs.table instead of building an HTML table on the fly, but I’m not sure how to control the content editable properties of Inputs.table sufficiently: I want the header row and the first column to be not editable, and I want to turn off column sorting.
(The second htl.html call turns a markup string into an Element – otherwise the markup would get rendered as escaped plain text.)
and I want to turn off column sorting
To be honest, I suspect that you’ll have more trouble making Inputs.table work for your use case than implementing your own table renderer (or using an existing library / import).
Great question! According to this issue they don’t consider the API and polyfill stable enough yet to publish to npm. You could probably make it work somehow (e.g., by requiring the script that’s used in the polyfill demo, or by importing via jsdelivr’s GitHub endpoint), but I’d recommend to look into alternative libraries instead, like the ones listed in this issue.
I would also argue that you don’t actually need HTML sanitization. Unless you want to provide formatting capabilities, a simple text input or textarea should suffice. You can remove all styles and make the element autogrow to adapt to its content.
OK so I sort of got it working just by importing from the demo site as you suggested. It executes the script in the context of the notebook, however this doesn’t help notebooks that import from my editable-table notebook…I guess they need to import the sanitizer for it to execute. Any tricks there? Or perhaps this is a steamroller to crack a nut