为了删除一段javascript代码,我使用了这段氚文本。
# to remove an inline js code based on text search
$("//script[contains(text(),'textiwanttoremove')]") {
text(){
replace('thetextiwanttoremove','')
}
}但是,这段代码不起作用。我犯了个错误
Failed to create body.ts transformer:
scripts/main.ts:13: function Text.$(Text) does not exist in namespace tritium; (called from Text.with(Regexp)).另外,如果我将text()替换为inner(),它仍然不能工作,谢谢。
发布于 2015-02-25 08:17:17
您好,请确认您的Mixer.loc文件中是否存在混合器stdlib,然后尝试使用以下替换:http://www.tritium.io/current#Text.replace(Regexp%20%25search,%20Text%20%25with)
$(".//script[contains(text(), 'txt2remove')]") {
text() {
replace(/txt2remove/, '')
}
}那应该管用。
胡安·卡米洛
https://stackoverflow.com/questions/28633955
复制相似问题