Closed qsiebers closed 7 years ago
I went with a simpler approach, but I borrowed your ExecutableScript
pattern and your unit tests. Thanks!
I'm not sure how good I got that regex, I seem to recall having some issues with it. But hey, if the test cases work...
String#extractScripts passes any scripts in the string to String#evalScripts, regardless of type. To increase integration support with other tools (like handlebars or dot.js) and increase stability a check of the type should be added. Scripts without type should still be evaluated as they default to javascript according to specs.
I've tried to tackle this by changing the Prototype.ScriptFragment regex, but without success. The submitted code is not perfect, but gets the job done. Alternatives are welcome.