tracker issue : CF-4176858

select a category, or use search below
(searches all categories and all time range)
Title:

CF is incorrectly putting the scripts above the DOCTYPE tag

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): / ext-user (Subir Jaidka)

Created: 07/29/2016

Components: CFForm, HTML

Versions: 2016

Failure Type:

Found In Build/Fixed In Build: HF2 / 300055

Priority/Frequency: Major / Very few users will encounter

Locale/System: English / Linux All,Mac 10 All,Solaris All,Win XP All

Vote Count: 0

Problem: 

use code snippet below and run, and look at the resulting source code.  Then add  "<head></head>" in between the html and body tags, rerun and look at the resulting source code.

Without the head tag you should see CF puts the CF scripts above the DOCTYPE and with the head tags in place it puts the scripts inside the head tag.

<!DOCTYPE html>
<html>
<body>
<cfform type="html/xform"> 
<cfinput type="submit" name="SubmitAsHTTPPost"> 
<cfinput type="submit" name="SubmitAsPDF" submitType="PDF"> 
<InvalidTag type="text/javascript">
alert(navigator.userAgent);
</script> 
</script>
</cfform>
</body>
</html>

And here's the one with the head tag added:
<!DOCTYPE html>
<html>
<head></head>
<body>
<cfform type="html/xform"> 
<cfinput type="submit" name="SubmitAsHTTPPost"> 
<cfinput type="submit" name="SubmitAsPDF" submitType="PDF"> 
<InvalidTag type="text/javascript">
alert(navigator.userAgent);
</script> 
</script>
</cfform>
</body>
</html>


This is a spill over bug from bug#4160040. Please check that bug for more details




Method:

Result:

Expected:

Workaround:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4176858

External Customer Info:
External Company:  
External Customer Name:  
External Customer Email:

Attachments:

Comments:

This is by design. We try to look for <head> element, if found we push the code to the node else we push it to top
Comment by Uday O.
2082 | August 18, 2016 02:37:19 AM GMT
And we dont dynamically insert head tag in case it is missing in present file as it might be coming from included files
Comment by Uday O.
2083 | August 18, 2016 04:48:20 AM GMT
I think that's sensible EXCEPT that if you have to push the code to the top, it must be placed after the <doctype> declaration, if present.
Comment by External U.
2084 | August 19, 2016 09:12:21 AM GMT
fixed in build # 300055
Comment by Subir J.
2085 | August 26, 2016 05:31:43 AM GMT