-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
script tags #14
Comments
yeah browsers wont execute them via innerHTML, I can't recall why, some legacy / security issue probably. jQuery does that portion for you |
Reckon it's worth adding? Perhaps as a separate component? |
it's definitely subjective, might as well be a separate component I think, later we can use that new one thought domify as an option if it makes sense |
looks like in IE, you have to set the closing for now. |
running into this right now. basically we are loading a script from microsoft which itself overrides https://gist.github.com/lancejpollard/a6f9309f47e3bda874af#file-microsoft-md they give you a way to set a function so you can avoid overriding window.mstag._write = function(str){
document.body.appendChild(domify(str));
}; that would be cool because if microsoft were to ever change their internal implementation to include more than just script tags, it wouldn't break. currently, they pass both if not, you'd pretty much have to always do something like this if you wanted it to be robust: document.body.appendChild(scriptify(domify(src)); thoughts? |
I run into this as well. Bet when I was searching for solution I found this - http://stackoverflow.com/questions/2592092/executing-script-elements-inserted-with-innerhtml - and isn't nice at all :-/ |
/cc @jonathanong can we add something like this to it? |
remove all the script tags after domifying the html, remove them all, append the child, then eval them. not sure what else to do. but i have no idea what to do with |
@jonathanong the var el = domify(str);
if ('script' == el.tagName.toLowerCase() && el.getAttribute('src')) {
var tmp = document.createElement('script');
tmp.src = el.getAttribute('src');
tmp.async = true;
el = tmp;
} but for each script tag we should do that. can we include that in this library? otherwise domify doesn't work as you'd expect. maybe it should go somewhere else? |
yeah i don't mind. should be a separate method that pulls the scripts and rejiggers them. something like: var el = domify(str);
var scripts = domify.scripts(el); then |
Not exactly sure what the issue is (no time to debug ATM), but discovered a
script
element created bydomify
doesn't load its src when its added to the dom, unlike a script tag added viadocument.createElement('script')
.The text was updated successfully, but these errors were encountered: