1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-25 18:56:28 +02:00

Move escapeHTML to dom utils

This commit is contained in:
Brett Sun 2016-06-13 17:33:59 +02:00
parent 4d4cb7f505
commit 17762ed7b2
3 changed files with 14 additions and 13 deletions

View File

@ -8,8 +8,8 @@ import audiojs from '../../third_party/imports/audiojs';
import shmui from '../../third_party/imports/shmui';
import videojs from '../../third_party/imports/videojs';
import { escapeHTML } from '../../utils/dom';
import { extractFileExtensionFromUrl } from '../../utils/file';
import { escapeHTML } from '../../utils/general';
/**

View File

@ -4,6 +4,19 @@ import React from 'react';
import { getLinkRegex, isEmail } from './regex';
/**
* Escape HTML in a string so it can be injected safely using React's `dangerouslySetInnerHTML`
*
* @param {string} s String to be sanitized
* @return {string} Sanitized string
*
* Taken from: http://stackoverflow.com/a/17546215/597097
*/
export function escapeHTML(s) {
return document.createElement('div').appendChild(document.createTextNode(s)).parentNode.innerHTML;
}
/**
* Set the title in the browser window.
*/

View File

@ -14,15 +14,3 @@ export {
sanitizeList,
selectFromObject
} from 'js-utility-belt/es6';
/**
* Escape HTML in a string so it can be injected safely using
* React's `dangerouslySetInnerHTML`
*
* @param s the string to be sanitized
*
* Taken from: http://stackoverflow.com/a/17546215/597097
*/
export function escapeHTML(s) {
return document.createElement('div').appendChild(document.createTextNode(s)).parentNode.innerHTML;
}