css - Why string assignment in javaScript is case insensitive? -


I have created simple HTML pages with a button, when its color changes when clicked:

  & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; & Lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Button onclick = "if (this.style.backgroundColor == 'red') {this.style.backgroundColor = 'green'} else {this.style.backgroundColor = 'Red'} alert (this.style.backgroundColor)" & Gt; Ok & lt; / Button & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

It is surprising to me that is the warning (this.style.backgroundColor) instead of red red . Why? An assignment is this.style.backgroundColor = 'Red' and starts with capitalization in Red .

CSS styles have not been saved as a literal string, they are in the internal, Are changed. Color styles are case-insensitive, and the canonical representation is lowercase.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -