1 Reply Latest reply on Feb 10, 2014 1:42 PM by Patrick Wolf-Oracle

    BUG: Page template substitution #GENERATED_CSS# outputs javascript

    Stephen Blair

      This issue has caught me out a few times when developing new page templates and I haven't seen it raised elsewhere.


      Best practice regarding stylesheets/styles and javascript is to output stylesheets/styles in the <head></head> and javascript before the closing </body> tag.


      APEX page templates provide plenty of subst. strings to place these resources around but the subject issue causes a cascade of problems that prevent APEX page templates from following best practice.


      #GENERATED_CSS# is used to output the dynamic action event list when dynamic actions are present on the page:

      <script type="text/javascript">

      apex.da.initDaEventList = function(){
      apex.da.gEventList = [ --- code here ---];

      This code refers to the apex object which means #APEX_JAVASCRIPT# must be output before this subst. string to avoid a javascript error. There are two outcomes:

      Place #GENERATED_CSS# before the closing  </body> tag, potentially outputting stylesheets/styles in the body which, although causes no problems for now, is invalid.

      Place #GENERATED_CSS# in the <head></head> (with all other #CSS# subst. strings) and move #APEX_JAVASCRIPT# into the <head></head> in amongst #CSS# subst. strings, which is not best practice.

      Both of these options are confusing. Since the source of the confusion is using a #CSS# subst. string to output javascript it would be great if the output could be fixed, and the dynamic action event list is output at the start of #GENERATED_JAVASCRIPT# instead.