0

I'm building a web app, just like CodePen or something like that. It offers user to input code and run in browser.

My problem is, I got a css text string from user input, and in order to limit the css scope. I need to add an extra selector (i.e. #user-css) before every css rule.

In other words, it's just a string manipulation, But there maybe have @keyframes , @media or comment, etc to avoid.

troy
  • 387
  • 1
  • 9
  • JSFiddle works with an API that will return content in an `iframe` so far as i know. I think you can output the entered code of an user in an `iframe` directly – UfguFugullu Jun 02 '17 at 11:43
  • see [this](https://stackoverflow.com/questions/10418644/creating-an-iframe-with-given-html-dynamically) discussion – Frank Wisniewski Jun 02 '17 at 11:47
  • I know iframe could do this, but I'm about to improve an existing project, which means I have to change the whole framework to make it happen. – troy Jun 02 '17 at 11:58

0 Answers0