|
@@ -240,9 +240,11 @@ export default class AutoHeightWebView extends PureComponent {
|
240
|
240
|
if (!styles) {
|
241
|
241
|
return script;
|
242
|
242
|
}
|
|
243
|
+ // Escape any single quotes or newlines in the CSS with .replace()
|
|
244
|
+ const escaped = styles.replace(/\'/g, "\\'").replace(/\n/g, '\\n')
|
243
|
245
|
return `
|
244
|
246
|
var styleElement = document.createElement('style');
|
245
|
|
- var styleText = document.createTextNode('${styles}');
|
|
247
|
+ var styleText = document.createTextNode('${escaped}');
|
246
|
248
|
styleElement.appendChild(styleText);
|
247
|
249
|
document.head.appendChild(styleElement);
|
248
|
250
|
${script}
|