rspec/rules/S1084/html/rule.adoc

27 lines
789 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
There are two ways to build a link that has the sole purpose of running JavaScript code. The goal of this rule is to ban such patterns in order to support browsing with JavaScript disabled.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
<a href="#" onclick="alert('Clicked!'); return false;">Run JavaScript Code</a> <!-- Noncompliant -->
<a href="javascript:void(0)" onclick="alert('Clicked!'); return false;">Run JavaScript Code</a> <!-- Noncompliant -->
<a id="inPageAnchor">Jump down the page to me</a> <!-- Compliant -->
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
<a id="inPageAnchor">Jump down the page to me</a> <!-- Compliant -->
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]