diff options
Diffstat (limited to 'extension/lib')
-rw-r--r-- | extension/lib/polyfill-react.js | 16 | ||||
-rw-r--r-- | extension/lib/polyfill-react.ts | 19 |
2 files changed, 35 insertions, 0 deletions
diff --git a/extension/lib/polyfill-react.js b/extension/lib/polyfill-react.js new file mode 100644 index 000000000..f30ba7c64 --- /dev/null +++ b/extension/lib/polyfill-react.js @@ -0,0 +1,16 @@ +"use strict"; +let React = { + createElement: function (tag, props, ...children) { + let e = document.createElement(tag); + for (let k in props) { + e.setAttribute(k, props[k]); + } + for (let child of children) { + if ("string" === typeof child || "number" == typeof child) { + child = document.createTextNode(child); + } + e.appendChild(child); + } + return e; + } +}; diff --git a/extension/lib/polyfill-react.ts b/extension/lib/polyfill-react.ts new file mode 100644 index 000000000..8238093ab --- /dev/null +++ b/extension/lib/polyfill-react.ts @@ -0,0 +1,19 @@ +"use strict"; + +let React = { + createElement: function(tag, props, ...children) { + let e = document.createElement(tag); + for (let k in props) { + e.setAttribute(k, props[k]); + } + for (let child of children) { + if ("string" === typeof child || "number" == typeof child) { + child = document.createTextNode(child); + } + e.appendChild(child); + } + return e; + } +}; + + |