Closed Bug 285888 Opened 19 years ago Closed 19 years ago

FireFox Eats Double-Quotes!!!

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows XP
defect
Not set
critical

Tracking

()

RESOLVED INVALID

People

(Reporter: revengist, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050225 Firefox/1.0.1

The problem can be seen by using this example:
<option onClick="var d='2';var s='Test Example';var m='\"';setvals(d,s,m)">
Put that in a file and name it test.html
Open it with firefox. FireFox will eat the last double quote and put the source as:
<option onClick="var d='2';var s='Test Example';var m='\"';setvals(d,s,m)>

This is so frustrating. Can someone please tell a temp solution until the actual
problem is fixed.


Reproducible: Always

Steps to Reproduce:
1.Have a piece of a string escaped in between a tag like, onLoad="var t='\"';"
2.Load in FireFox
3.The Last Double-Quote of the onLoad tag, will be eaten.

Actual Results:  
The double-quote was eaten!!!

Expected Results:  
Not eaten the double-quote? why is ff so hungry? :(
Assignee: firefox → parser
Component: General → HTML: Parser
Product: Firefox → Core
QA Contact: general → mrbkap
Version: unspecified → Trunk
The correct way to escape quotation marks in HTML is to use &quot;. If you are
talking about the view-source problem where (wrong) quotes would disappear, this
bug has already been fixed in nightly builds (and will be fixed when Firefox 1.1
comes out).

Based on the summary, I'm marking this bug a dupe of the view-source problem.
Please use &quot; (and not \") to escape quotation marks!

*** This bug has been marked as a duplicate of 43267 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
No, &quot;, would create a non-parsed quote that shows up as plaintext on the
page. \" would be a regular quote that javascript will turn into ".

similar to \n = linebreak \t = tab, well \" = quote

firefox seems to be eating the last quote, and screwing up the whole parsing of
the page. its a CRITICAL problem :(
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Except your javascript is in an attribute value, which goes through the HTML
parser before ever reaching the javascript engine. One of the jobs of the HTML
parser is to turn such character entities (in attributes and elsewhere) into
their character equivalents.

Try, for instance:
<a href="#" onclick="3 &lt; 4 ? alert(&apos;&quot;&apos;) :
alert(&quot;&apos;&quot;)">click</a>

Note that if you use an inline <script> tag, entities are *not* expanded, so:
<script>3 &lt; 4 ? ...</script> is a syntax error
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.