如何将此咖啡脚本转换为 js/jquery

How can I convert this coffeescript to js/jquery?

本文关键字:js jquery 转换 脚本 咖啡      更新时间:2023-09-26
text = child.html()
text = text.replace /(#include('s*&lt;.*&gt;)?)/gi, '<span>$1</span>'
text = text.replace /(main'(.*'))/gi, '<span>$1</span>'
child.html text

http://jsfiddle.net/dcro/XKHC8/

这是我问题的答案:用我不知道如何使用咖啡脚本的跨度包装字符串,回答的人看起来不可用。

来自 js2coffee.org

var text;
text = text.replace(/(#include('s*&lt;.*&gt;)?)/gi, '<span>$1</span>');
text = text.replace(/(main'(.*'))/gi, '<span>$1</span>');
child.html(text);