
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Internet Explorer offers a way to change the JavaScript code at runtime using conditional comments (activated by a @cc_on statement found in a comment). Using this preprocessing feature decreases readability and maintainability, and can hinder automated tools. What's more, it is specific to Internet Explorer and won't work for other browsers.
|
|
|
|
|
|
Most of the time, using those conditional comments can be easily avoided with some refactoring - using modern cross-browsers JavaScript frameworks and libraries.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
/*@cc_on
|
|
@if (@_jscript_version >= 5.5)
|
|
document.write("You are using IE5.5 or newer");
|
|
@else
|
|
document.write("You are using IE5 or older");
|
|
@end
|
|
@*/
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Refactor your code to avoid using Internet Explorer's conditional comments.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 1 Nov 2019, 16:28:18 Elena Vilchik wrote:
|
|
See \https://github.com/SonarSource/SonarJS/issues/1698
|
|
|
|
endif::env-github,rspecator-view[]
|