Skip to content

Commit

Permalink
chore: add DOMPurify to CSP example
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding-SE committed Oct 30, 2023
1 parent f40bf3b commit 1e13388
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions examples/example-csp-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ <h2>View Source:</h2>
</table>

<script src="https://cdn.jsdelivr.net/npm/sortablejs/Sortable.min.js"></script>
<script src="sortable-cdn-fallback.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dompurify@3.0.6/dist/purify.min.js"></script>

<script src="../dist/browser/slick.core.js"></script>
<script src="../dist/browser/slick.interactions.js"></script>
<script src="../dist/browser/slick.grid.js"></script>
<script src="../dist/browser/plugins/slick.cellrangedecorator.js"></script>
<script src="../dist/browser/plugins/slick.cellrangeselector.js"></script>
<script src="../dist/browser/plugins/slick.cellselectionmodel.js"></script>

<script src="./example-csp-header.js"></script>
</body>
</html>
5 changes: 3 additions & 2 deletions examples/example-csp-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ var columns = [

var options = {
enableCellNavigation: true,
enableColumnReorder: false
enableColumnReorder: false,
sanitizer: (dirtyHtml) => DOMPurify.sanitize(dirtyHtml, { RETURN_TRUSTED_TYPE: true })
};

document.addEventListener("DOMContentLoaded", function () {
Expand All @@ -31,7 +32,7 @@ document.addEventListener("DOMContentLoaded", function () {
percentComplete: Math.round(Math.random() * 100),
start: "01/01/2009",
finish: "01/05/2009",
effortDriven: (i % 5 == 0)
effortDriven: (i % 5 === 0)
};
}

Expand Down

0 comments on commit 1e13388

Please sign in to comment.