简体   繁体   English

如何更改“ to-markdown.js”,使其将作为服务器端JScript运行

[英]How to Change “to-markdown.js” So it Will Run as Server Side JScript

I am trying to wrap a javascript in <script type="javascript" runat="server"> ... </script> tags so that I can access it from vbScript/classic asp. 我试图在<script type="javascript" runat="server"> ... </script>标记中包装JavaScript,以便可以从vbScript /经典ASP中访问它。

Normally this works fine, but I think there is something in the script I am trying to use that isn't compatible with jScript, but I am not sure how to change it so that it just works. 通常,这可以正常工作,但是我认为我尝试使用的脚本中有一些与jScript不兼容的东西,但是我不确定如何更改它以便它可以正常工作。

The js I am trying to use is here: https://github.com/domchristie/to-markdown/blob/master/dist/to-markdown.js 我要使用的js在这里: https : //github.com/domchristie/to-markdown/blob/master/dist/to-markdown.js

The error i am seeing in jScript is : 我在jScript中看到的错误是:

Microsoft JScript runtime error '800a01b6'
Object doesn't support this property or method
/bfadmin/markdown/h2m.asp, line 583

...line 583 is this line of the source javascript: ...第583行是源javascript的这一行:

Object.keys(voidElements).forEach(function (name) {

I am not trying to use any of the extenstions... so if those are whats causing the issue, they could be removed. 我不尝试使用任何扩展...因此,如果这些是引起问题的原因,则可以将其删除。 I am just not sure what to remove in order to use it. 我只是不确定要删除什么才能使用它。

Is what I am trying to do possible and if so, how must the js be changed to work as jscript. 我正在尝试做的是可能的,如果可能的话,必须如何更改js以使其像jscript一样工作。

Array.forEach is an ECMAScript 5 method, and server-side JScript is generally ECMAScript 3. One way to get around this without modifying the script you're including is by using a polyfill, such as the one from the MDN documentation I linked to. Array.forEach是ECMAScript 5方法,而服务器端JScript通常是ECMAScript3。一种无需修改您要包含的脚本即可解决此问题的方法是使用polyfill,例如我链接到的MDN文档中的一种。 。 More generally, there are polyfill libraries out there that add mostly-compatible ECMAScript 5 methods to ECMAScript 3 environments. 更一般而言,那里有polyfill库,它们向ECMAScript 3环境添加了大多数兼容的ECMAScript 5方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM