Skip to content

Instantly share code, notes, and snippets.

@jimmywarting
Last active March 23, 2025 07:57
Show Gist options
  • Save jimmywarting/0dfe134f82353ecea8d32b9667d91f7c to your computer and use it in GitHub Desktop.
Save jimmywarting/0dfe134f82353ecea8d32b9667d91f7c to your computer and use it in GitHub Desktop.

Revisions

  1. jimmywarting revised this gist Mar 23, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion toSafeNode.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    When csp are in the way and require you to use [trustedTypes](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API) html
    This is for when you are building a library and csp are in the way and require you to use [trustedTypes](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API) html

    ```js
    var toSafeNode=(h,x=new XMLHttpRequest)=>(x.send(x.open('GET',URL.createObjectURL(new Blob([h])),0)),x.responseXML)
  2. jimmywarting revised this gist Mar 23, 2025. No changes.
  3. jimmywarting revised this gist Mar 23, 2025. No changes.
  4. jimmywarting revised this gist Mar 23, 2025. No changes.
  5. jimmywarting revised this gist Mar 23, 2025. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions toSafeNode.md
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,7 @@ When csp are in the way and require you to use [trustedTypes](https://developer.

    ```js
    var toSafeNode=(h,x=new XMLHttpRequest)=>(x.send(x.open('GET',URL.createObjectURL(new Blob([h])),0)),x.responseXML)
    ```
    ```js
    var fragment = toSafeNode('<div>hej</div>')
    ```
  6. jimmywarting created this gist Mar 23, 2025.
    5 changes: 5 additions & 0 deletions toSafeNode.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    When csp are in the way and require you to use [trustedTypes](https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API) html

    ```js
    var toSafeNode=(h,x=new XMLHttpRequest)=>(x.send(x.open('GET',URL.createObjectURL(new Blob([h])),0)),x.responseXML)
    ```