Closed Bug 271252 Opened 20 years ago Closed 20 years ago

Firefox renders BASE HREF comment when comment is broken

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: david, Assigned: bugzilla)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

This is a typical "base href" comment, found in the <head> element:

  <!-- base href="http://www.foo.bar/" -->

When the base-href comment is broken, such as:

 <!-- base -- href = "http://www.foo.bar/" -->

Firefox ignores the "<!--" and renders the comment as part of the page (usually
displayed at the top of all page content)

You can work around it by putting something infront of the "base" keyword, it
seems Firefox looks for "<!-- base" in HTML documents, so by breaking this, it
doesn't appear

Reproducible: Always
Steps to Reproduce:
1. Create any old HTML document (I used XHTML1.1)
2. Put "<!-- base href="http://www.foo.bar/" -->" in your <head> to tell the UA
what the default base to truncated HREF'd URIs are
3. Render... it looks fine
4. Replace the comment with "<!-- base -- href = "http://www.foo.bar/" -->"
5. Render....you'll notice that "-- base -- href = "http://www.foo.bar/" -->"
appear at the top of the page

Actual Results:  
The string "-- base -- href = "http://www.foo.bar/" -->" appear at the top of
the page

Expected Results:  
Firefox is supposed to treat it as a comment if the string is broken or poorly
formed, rather than rendering it
That's supposed to happen.  You can't have -- in the body of the comment,
because that opens/closes the comment.  See
http://www.w3.org/TR/html401/intro/sgmltut.html#idx-HTML
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.