Ticket #230 (closed enhancement: fixed)

Opened 13 months ago

Last modified 2 months ago

Add option to add JS before HTML body in HtmlProperty

Reported by: peterfarrell Owned by: peterfarrell
Priority: minor Milestone: Mach-II 1.9.0 Milestone 1
Component: framework - properties Version: 1.9.0 - Framework
Keywords: HtmlHelperProperty body add javascript css outputType Cc: mattwoodward, kurtwiersma, brianfitzgerald, andrew.leaf@…
Blocking: Blocked By:

Description

As suggested by a comment on the HtmlHelperProperty M2SFP to optionally to add JS before HTML body in HtmlHelperProperty. Currently, the outputType attributes supports head and inline.

Attachments

Change History

Changed 13 months ago by peterfarrell

Just wanted to clarify. To add the script tags before the closing HTML body tag.

Changed 13 months ago by peterfarrell

  • version changed from 2.0.0 - Framework to 1.8.0 - Framework

Changed 12 months ago by peterfarrell

Guys, I'm not sure how to support this, but I think this is something we need to investigate. We currently do this in the MachIILogger to append the logging out right before the closing body tag. I think it only supports Adobe CF, but I'm not sure. Matt could check to see if the logging out is append before the closing body tag on OpenBD?

Any thoughts? I think we'd add this as addHTMLBodyElement() akin to the addHTMLHeadElement() method we already have so we have an observable point for the caching stuff. Right now addHTMLHeadElement() uses cfhtmlhead tag, but since there isn't any compatibility between CFML engines -- we'd have to roll our own solution. It think this could be done by using the onRequestEndCallback() point that runs at the end of the request.

Changed 11 months ago by andrew.leaf@…

I ran into an issue last night where I created a core asset that I wanted to load at the top over every page on every request. I then have a view that has a form where I am loading another js file to do some validation. Since this page is handled first before I call the core layout. The core js files are append after the validation js file. This causes an error. I had to do an inline insert so that the validation js file is injected after the core.

The problem is that the js file is down in the body. Is it possible to specify where to append other attributes to a core asset. Example I have a core set of js files I want to load and then a view is called that needs validation. If there was an additional attribute that could be called to appended. e.g. append="core"

Changed 11 months ago by peterfarrell

Well, I don't know if we can offer what you ask as behind the scenes the html helper uses cfhtmlhead. So the solution would be no different when cfhtmlhead or the methods with the html helper.

I'm extrapolating some information here based on message, but your core libraries are probably being appended to head in your layout view (probably call from within the head section too). So I would just have the helper append "inline" (output directly instead of using cfhtmlhead behind the scenes) by making the call from within the html head section if these libraries are really are "core" assets to be included.

The other option is to create an asset package in which assets are defined and included in order (not to mention it tracks if the assets has already appended to head and ignores it if it has so you don't have to worry about multiple declarations to that asset).

Changed 11 months ago by peterfarrell

  • cc kurtwiersma, brianfitzgerald, andrew.leaf@… added; kurtwiersma brianfitzgerald removed
  • version changed from 1.8.0 - Framework to 1.9.0 - Framework
  • milestone changed from Mach-II 1.8.0 alpha to Mach-II 1.9.0 alpha

I guess I wanted to bump this issue with the team about adding the ability to add assets to the before of the closing </body>. I think it's a nifty idea and ultimately would be nice, but harder to implement (because we're using the servlet objects via getPageContext() and those all different between the CFML engines).

Unless somebody knows of an easy way to support this on Adobe CF, Open BD and Railo at the moment, I'm going to retarget this feature request for 1.9 due to the fact we have extremely limited engineering time remaining before the beta.

Changed 4 months ago by peterfarrell

FYI, support for appending to the body will be added in 1.9 when used on Open BD since that engine as of post 1.2 release supports the <cfhtmlbody> tag.

Changed 3 months ago by peterfarrell

  • status changed from new to assigned

We will implement in 1.9 when deployed on OpenBD

Changed 3 months ago by peterfarrell

  • milestone changed from Mach-II 1.9.0 alpha to Mach-II 1.9.0 Milestone 1

Re-targeted for the Integrity Milestone 1

Changed 2 months ago by peterfarrell

(In [2068]) Basic plumbing to support addHtmlBodyElement so ticket #230 can be worked on. refs #230

Changed 2 months ago by peterfarrell

  • status changed from assigned to closed
  • resolution set to fixed

(In [2073]) closes #230

Add/Change #230 (Add option to add JS before HTML body in HtmlProperty)

Author


E-mail address and user name can be saved in the Preferences.


Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.