mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-09 23:44:06 +08:00
87 lines
4.8 KiB
HTML
87 lines
4.8 KiB
HTML
<article id="wikiArticle">
|
||
<div></div>
|
||
<h2 id="信息">信息</h2>
|
||
<pre><code class="language-javascript">Warning: SyntaxError: Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead
|
||
|
||
Warning: SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
|
||
</code></pre>
|
||
<h2 id="错误类型">错误类型</h2>
|
||
<p><a href="Reference/Global_Objects/SyntaxError" title="SyntaxError 对象代表尝试解析语法上不合法的代码的错误。"><code>SyntaxError</code></a> 的警告。不会终止 JavaScript 的执行。</p>
|
||
<h2 id="哪里错了">哪里错了?</h2>
|
||
<p>在 JavaScript 源码中使用了已废弃的 source map 语法。</p>
|
||
<p>JavaScript 源代码经常被组合和压缩,以便能更高效地从服务器获取它们。使用了 <a class="external" href="http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/" rel="noopener">source maps</a>,调试器就可以将正在执行的代码映射到原始源文件。</p>
|
||
<p>因为 IE 浏览器只要页面在 <code>//@cc_on</code> 之后的都会被IE JScript引擎解释为打开条件编译后,所以 source map 的规范更改了语法。<a class="external" href="https://msdn.microsoft.com/en-us/library/8ka90k2e%28v=vs.94%29.aspx" rel="noopener">条件编译注释</a> 是 IE 的一个小特色,但是它破坏了 <a class="external" href="https://bugs.jquery.com/ticket/13274" rel="noopener">jQuery</a> 和其他库的 source map。</p>
|
||
<h2 id="示例">示例</h2>
|
||
<h3 id="废弃的语法">废弃的语法</h3>
|
||
<p>使用 "@" 符号的语法已经被废弃了。</p>
|
||
<pre><code class="language-js example-bad">//@ sourceMappingURL=http://example.com/path/to/your/sourcemap.map
|
||
</code></pre>
|
||
<h3 id="标准语法">标准语法</h3>
|
||
<p>使用 "#" 符号代替。</p>
|
||
<pre><code class="language-js example-good">//# sourceMappingURL=http://example.com/path/to/your/sourcemap.map</code></pre>
|
||
<p>或者,您也可以为 JavaScript 文件设置 header,以避免添加注释:</p>
|
||
<pre><code class="language-js example-good">X-SourceMap: /path/to/file.js.map</code></pre>
|
||
<h2 id="浏览器兼容性">浏览器兼容性</h2>
|
||
<p></p><div class="blockIndicator warning"><strong><a class="external" href="https://github.com/mdn/browser-compat-data" rel="noopener">We're converting our compatibility data into a machine-readable JSON format</a></strong>.
|
||
This compatibility table still uses the old format,
|
||
because we haven't yet converted the data it contains.
|
||
<strong><a class="new" href="/zh-CN/docs/MDN/Contribute/Structures/Compatibility_tables" rel="nofollow">Find out how you can help!</a></strong></div>
|
||
<div class="htab">
|
||
<a id="AutoCompatibilityTable" name="AutoCompatibilityTable"></a>
|
||
<ul>
|
||
<li class="selected"><a>Desktop</a></li>
|
||
<li><a>Mobile</a></li>
|
||
</ul>
|
||
</div><p></p>
|
||
<div id="compat-desktop">
|
||
<table class="compat-table">
|
||
<tbody>
|
||
<tr>
|
||
<th>Feature</th>
|
||
<th>Chrome</th>
|
||
<th>Firefox (Gecko)</th>
|
||
<th>Internet Explorer</th>
|
||
<th>Opera</th>
|
||
<th>Safari</th>
|
||
</tr>
|
||
<tr>
|
||
<td>New syntax</td>
|
||
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
|
||
<td><a href="/en-US/Firefox/Releases/24" title="Released on 2013-09-17.">24</a> (24)</td>
|
||
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
|
||
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
|
||
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div id="compat-mobile">
|
||
<table class="compat-table">
|
||
<tbody>
|
||
<tr>
|
||
<th>Feature</th>
|
||
<th>Android</th>
|
||
<th>Chrome for Android</th>
|
||
<th>Firefox Mobile (Gecko)</th>
|
||
<th>IE Mobile</th>
|
||
<th>Opera Mobile</th>
|
||
<th>Safari Mobile</th>
|
||
</tr>
|
||
<tr>
|
||
<td>New syntax</td>
|
||
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
|
||
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
|
||
<td>24.0 (24)</td>
|
||
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
|
||
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
|
||
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<h2 id="相关">相关</h2>
|
||
<ul>
|
||
<li><a href="/en-US/docs/Tools/Debugger/How_to/Use_a_source_map">How to use a source map – Firefox Tools documentation</a></li>
|
||
<li><a class="external" href="http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/" rel="noopener">Introduction to source maps – HTML5 rocks</a></li>
|
||
</ul>
|
||
</article> |