Skip to content
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

IE8 support for JSXTransformer #484

Merged
merged 1 commit into from
Nov 8, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
},
"dependencies": {
"commoner": "~0.8.7",
"esprima-fb": "~1001.1001.2000-dev-harmony-fb",
"jstransform": "~1.0.1"
"esprima-fb": "~2001.1001.0-dev-harmony-fb",
"jstransform": "~2.0.1"
},
"devDependencies": {
"browserify": "~2.34.1",
Expand Down
16 changes: 10 additions & 6 deletions vendor/browser-transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var run = exports.run = function(code) {
var functionBody = jsx ? transform(code).code : code;
var scriptEl = document.createElement('script');

scriptEl.innerHTML = functionBody;
scriptEl.text = functionBody;
headEl.appendChild(scriptEl);
};

Expand Down Expand Up @@ -75,11 +75,15 @@ var load = exports.load = function(url, callback) {

runScripts = function() {
var scripts = document.getElementsByTagName('script');
scripts = Array.prototype.slice.call(scripts);
var jsxScripts = scripts.filter(function(script) {
return script.type === 'text/jsx';
});


// Array.prototype.slice cannot be used on NodeList on IE8
var jsxScripts = [];
for (var i = 0; i < scripts.length; i++) {
if (scripts.item(i).type === 'text/jsx') {
jsxScripts.push(scripts.item(i));
}
}

console.warn("You are using the in-browser JSX transformer. Be sure to precompile your JSX for production - http://facebook.github.io/react/docs/tooling-integration.html#jsx");

jsxScripts.forEach(function(script) {
Expand Down