Closed zh217 closed 10 years ago
Can you create a simple example that demonstrates the issue. I know it does not execute the code but I have not seen issues with the emitting of the text.
Sure. The following HTML will break deftemplate
:
<html>
<head>
</head>
<body>
<h1>Hello world!</h1>
<script type="text/javascript">
alert("oops");
</script>
</body>
</html>
You can find the complete example here. When I try to load index.html from Chrome I get this:
Uncaught TypeError: Cannot read property 'apply' of undefined
Everything goes fine if the script tag is removed.
I figured this out. It looks like the script tag is missing from your extern file. It might be best to pull the react-cljs(https://github.com/swannodette/react-cljs) and get the 10.0 version from there. They added the script tag to the extern recently but it has not be pushed to clojars yet. You can manually add with it the following code.
React.DOM.script = function(props, children) {};
This has taken me quite some time to figure out ...
It makes sense that source html containing scripts are not supported. However, since this only breaks under advanced compilation when the compiled code is actually running in the browser, and that the browser stack trace and error message aren't helpful at all, it would be much better that such errors are caught earlier, for example at compile time.