Closed Bug 83221 Opened 24 years ago Closed 20 years ago

<style>,<script> is automatically closed in view-source

Categories

(Core Graveyard :: View Source, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: megabyte, Assigned: doronr)

References

Details

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:0.9+) Gecko/20010527 BuildID: 2001052720 <style> is automatically closed with </style> even if it doesn't exist in the original document Reproducible: Always Steps to Reproduce: 1. Create a page with an unclosed <style> tag 2. Load it in Mozilla 3. View Source Actual Results: You'll see <style></style> Expected Results: It shouldn't have closed it automatically. Since when does Mozilla ever fix people's web pages for them? There may be reasons to leave it open.. we shouldn't assume. I can't remember if I filed this bug before... many many months ago. I can't seem to find it and since it still exists, I'm filing anyway.
Er... All the existing browsers have fairly error-tolerant parsing. Otherwise 90% of the pages out there will not display. Inserting a </style> upon detecting </head> while processing content inside a <style> tag seems like a reasonable thing to do.... Is the bug here just that view source shows the output of the parser instead of the original source?
It's just a _demo_ of bug 55583. Marking dupe. *** This bug has been marked as a duplicate of 55583 ***
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
Clearing mis-attributed dup. This bug is because view-source appears to build a well-formed content model. The other bug is about the document being re-fetched from the server (rather than using the cached copy sitting in the client).
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Confirming. I am also seing the problem with <script>. Not sure about the severity tough.
Assignee: clayton → harishd
Status: UNCONFIRMED → NEW
Component: HTML Element → Parser
Ever confirmed: true
adding to tracker bug
Blocks: 57724
In viewsource we should try to preserve the original document AMAP. But, I wouldn't sweat on this now. IMO, this a very low priority. Setting to FUTURE...unless somebody is willing to work on this. Boris, rbs?? ;-)
Target Milestone: --- → Future
I should note that if the <style> (or <script>) is in the <body>, and then any other tag comes after, it automatically closes the <style>, so it's not just a </head> thing. Older browsers stop rendering upon an unclosed <style>, which I think is a good thing-- makes designers fix their bad markup.
I guess harishd fixed this for <script/>, but not for an unclosed <script>, in bug 44186.
No longer blocks: 57724
*** This bug has been marked as a duplicate of 57724 ***
Status: NEW → RESOLVED
Closed: 24 years ago23 years ago
Resolution: --- → DUPLICATE
QA Contact: bsharma → moied
Reopening 57724 dependencies for independent resolution.
Status: RESOLVED → REOPENED
Depends on: 57724
Resolution: DUPLICATE → ---
Summary: <style> is automatically closed with </style> even if it doesn't exist in the original document → <style>,<script> is automatically closed with </style>,</script> even if it doesn't exist in the original document
*** Bug 127043 has been marked as a duplicate of this bug. ***
Fixing mangled summary.
Summary: <style>,<script> is automatically closed with </style>,</script> even if it doesn't exist in the original document → <style> is automatically closed with </style> in view source even if it doesn't exist in the original document
remangling summary (see previous comments)
Summary: <style> is automatically closed with </style> in view source even if it doesn't exist in the original document → <style>,<script> is automatically closed with </style>,</script> in view source even if it doesn't exist in the original document
*** Bug 182420 has been marked as a duplicate of this bug. ***
Changing summary to what it really should be. The view-source part is just bug 57724, but the actual tag closing affects rendering.
Summary: <style>,<script> is automatically closed with </style>,</script> in view source even if it doesn't exist in the original document → <style>,<script> is automatically closed if another HTML tag is reached
Imo, the non-viewsource part should be WONTFIX.....
The fact that its actually modifying the source code causes other problems, take this for example: <textarea wrap="soft" name="fdata" cols="100" style="width: 90%" rows="25">$banner .= "<script type='text/javascript'\n; $banner .=" src=''>\n"; $ibforums->skin['template'];</textarea> Mozilla modifies it to be like this: <textarea wrap="soft" name="fdata" cols="100" style="width: 90%" rows="25">$banner .= "<script type='text/javascript'\n; $banner .=" src=''>\n"; $ibforums-></script>skin['template'];</textarea> This means that including <script ... in a textarea without a closing tag is basically impossible and creates all sorts of problems... this needs to be resolved soon so people can include code like that in forms...
Including something like that in a textarea without escaping the '<' chars as &lt; is totally illegal in HTML in the first place.... We make it work as much as painlessly possible, but it's not perfect by any means.
I'm implicitly wontfixing the non-view-source part of this bug.
Assignee: harishd → doronr
Status: REOPENED → NEW
Component: HTML: Parser → ViewSource
Summary: <style>,<script> is automatically closed if another HTML tag is reached → <style>,<script> is automatically closed in view-source
Target Milestone: Future → ---
bz fixed this bug in bug 64799, marking this one as such.
Status: NEW → RESOLVED
Closed: 23 years ago20 years ago
Resolution: --- → FIXED
This had nothing to do with <textarea>. Reopening.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Note that it would be trivial to modify the code I added in bug 64799 to fix this, I think. Just add a check for view-source in addition to the one for PRESERVE_CONTENT. That said, it may not be worth wasting time on given the plans for a separate tokenizer...
*sigh*, the <script> has to be opened in the <body>. There is no bug if there is an unclosed <script> tag in the <head>. I'll leave this open until I fix bug 188609. Sorry for the confusion (and bugspam).
*** Bug 240636 has been marked as a duplicate of this bug. ***
This was really fixed by bug 258082.
Status: REOPENED → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
Product: SeaMonkey → Core Graveyard
You need to log in before you can comment on or make changes to this bug.