56 lines
1.3 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
The use of DOM attributes that are only supported by specific browsers can doom your website to obsolescence as the browser market shifts or the vendor that introduced the extension abandons it. Instead, it's always best to stick to standard attributes so that your site works for as broad a cross section of users as possible.
This rule raises an issue when ``++innerText++`` is used.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,javascript]
2021-04-28 16:49:39 +02:00
----
function setData(element) {
element.innerText = "Hello World!"; // Noncompliant
}
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,javascript]
2021-04-28 16:49:39 +02:00
----
function setData(element) {
element.textContent = "Hello World!";
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove this use of "innerText".
'''
== Comments And Links
(visible only on this page)
=== on 7 Apr 2015, 08:06:43 Linda Martin wrote:
\[~ann.campbell.2] Is the ``++inner.Text++`` - with the "." - in the description a typo ? Or does it refers to something else ? Just want to be sure I'm not removing meaning that I'm not aware of.
=== on 9 Apr 2015, 12:00:42 Ann Campbell wrote:
\[~linda.martin] I would describe that as less a "typo" and more a "brain fart" :-)
Fixed.
=== on 19 May 2015, 15:53:37 Linda Martin wrote:
Haha! Reviewe.
endif::env-github,rspecator-view[]