@samitouri / QOS-React-2 / commits / 595b482478

JSXTransformer now supports IE8

Andreas Svensson committed Nov 8, 2013 at 22:45 UTC 595b4824787ea20a2ec46194ea7f068ddeaf391f
2 files changed +12 -8
package.json
+2 -2
@@ -37,8 +37,8 @@
37 },
38 "dependencies": {
39 "commoner": "~0.8.7",
40 - "esprima-fb": "~1001.1001.2000-dev-harmony-fb",
41 - "jstransform": "~1.0.1"
40 + "esprima-fb": "~2001.1001.0-dev-harmony-fb",
41 + "jstransform": "~2.0.1"
42 },
43 "devDependencies": {
44 "browserify": "~2.34.1",
vendor/browser-transforms.js
+10 -6
@@ -43,7 +43,7 @@ var run = exports.run = function(code) {
43 var functionBody = jsx ? transform(code).code : code;
44 var scriptEl = document.createElement('script');
45
46 - scriptEl.innerHTML = functionBody;
46 + scriptEl.text = functionBody;
47 headEl.appendChild(scriptEl);
48 };
49
@@ -75,11 +75,15 @@ var load = exports.load = function(url, callback) {
75
76 runScripts = function() {
77 var scripts = document.getElementsByTagName('script');
78 - scripts = Array.prototype.slice.call(scripts);
79 - var jsxScripts = scripts.filter(function(script) {
80 - return script.type === 'text/jsx';
81 - });
82 -
78 +
79 + // Array.prototype.slice cannot be used on NodeList on IE8
80 + var jsxScripts = [];
81 + for (var i = 0; i < scripts.length; i++) {
82 + if (scripts.item(i).type === 'text/jsx') {
83 + jsxScripts.push(scripts.item(i));
84 + }
85 + }
86 +
87 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");
88
89 jsxScripts.forEach(function(script) {