-
Notifications
You must be signed in to change notification settings - Fork 48.7k
Wrap setInnerHTML in Windows 8 apps (Fixes #441) #2799
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
Conversation
@@ -28,6 +28,15 @@ var setInnerHTML = function(node, html) { | |||
node.innerHTML = html; | |||
}; | |||
|
|||
// Win8 apps: Allow all html to be inserted | |||
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { | |||
setInnerHTML = function (node, html) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no space after function
keyword
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, 2 space indent
Seems fine to me apart from the style nits. |
Thanks, code style now fixed :) |
Wrap setInnerHTML in Windows 8 apps (Fixes #441)
Thanks! |
I don't have access to W8, but could it make sense to wrap the entire transaction in |
There's also |
Regarding using setInnerHTMLUnsafe = function (element, text) {
83 msApp.execUnsafeLocalFunction(function () {
84 element.innerHTML = text;
85 });
86 }; As far as the placement of the wrapping goes, I'm not familiar with the React.js codebase so just chose the safest place for it. I noticed that the setInnerHTML function is used in a couple places in the codebase (as well as some where it isn't yet and I think it should be) so I didn't want to potentially litter the code with lots of checks for |
@stkb Aha, good detective work on On another note, I think createNodesFromMarkup needs to be wrapped as well (but it shouldn't reuse |
See #441
If React is running in a Windows 8 metro app, creates a version of setInnerHTML that uses execUnsafeLocalFunction to bypass the restrictive html-insertion security policy of that javascript runtime.