jsfiddle-integration-babel.js 的目的是什么?
What is the purpose of jsfiddle-integration-babel.js?
的目的是什么
<script src="https://facebook.github.io/react/js/jsfiddle-integration-babel.js">
</script>
在 Facebook 的 React 教程中找到 fiddle?
jsfiddle-integration-babel.js
的内容是
(function() {
var tag = document.querySelector(
'script[type="application/javascript;version=1.7"]'
);
if (!tag || tag.textContent.indexOf('window.onload=function(){') !== -1) {
alert('Bad JSFiddle configuration, please fork the original React JSFiddle');
}
tag.setAttribute('type', 'text/babel');
tag.textContent = tag.textContent.replace(/^\/\/<!\[CDATA\[/, '');
})();
看起来 tag
跟踪脚本并从中删除某些评论。但是为什么?
从评论中引用 azium
Presumably this is to make the jsfiddle environment babel friendly,
which may imply overriding existing jsfiddle code
<script src="https://facebook.github.io/react/js/jsfiddle-integration-babel.js">
</script>
在 Facebook 的 React 教程中找到 fiddle?
jsfiddle-integration-babel.js
的内容是
(function() {
var tag = document.querySelector(
'script[type="application/javascript;version=1.7"]'
);
if (!tag || tag.textContent.indexOf('window.onload=function(){') !== -1) {
alert('Bad JSFiddle configuration, please fork the original React JSFiddle');
}
tag.setAttribute('type', 'text/babel');
tag.textContent = tag.textContent.replace(/^\/\/<!\[CDATA\[/, '');
})();
看起来 tag
跟踪脚本并从中删除某些评论。但是为什么?
从评论中引用 azium
Presumably this is to make the jsfiddle environment babel friendly, which may imply overriding existing jsfiddle code