Reputation: 45
This question can be divided in two:
First, the browser is ignoring the escaping of quotes: A picture is worth one thousand words: https://i.sstatic.net/ZmlgJ.png
This didn't happen before. When did this behaviour change?
Also, why does the browser translate single quotes into double quotes? And how come it doesn't need escaping? For example: https://i.sstatic.net/endzi.png (The code in the inspector is the same code in the browser window)
Thanks in advance!
Upvotes: 1
Views: 406
Reputation: 91792
I´m not sure if it´s the cause of your problem, but it seems there's a mismatch in quotes in the part of 'Beginner's spear'
Upvotes: 0
Reputation: 944470
First, the browser is ignoring the escaping of quotes
HTML is not JavaScript. Quote characters inside an attribute value that match the quote characters used to delimit that value must be represented by entities, not prefixed by a slash.
<foo myAttribute="This value includes a double quote character: "">
This didn't happen before
Yes, it did.
Also, why does the browser translate single quotes into double quotes?
Browsers parse HTML into a DOM. At this stage there are no quotes, just attributes and values.
When you use a DOM inspector, it serialises back into HTML. The use of double quotes is a convention. Almost all HTML is written using "
to delimit attribute values.
That particular DOM inspector doesn't even really serialise the data. It just provides a visualisation. Here it uses a colour change to identify the attribute value.
Upvotes: 4