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


i have create simple html page 1 button change color when clicked:

<!doctype html> <html> <head>     <title></title> </head> <body> <button onclick="if (this.style.backgroundcolor == 'red') {         this.style.backgroundcolor = 'green'     }     else {         this.style.backgroundcolor = 'red'     }      alert(this.style.backgroundcolor)">     ok </button> </body> </html> 

it surprising me alert(this.style.backgroundcolor) return red instead of red. why? there assignment this.style.backgroundcolor = 'red' , in red start capital letter.

css styles aren't saved literal strings, they're converted internal, canonical representation of style. color styles case-insensitive, , canonical representation lowercase.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -