Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-774

Initialization JavaScript needs help when order counts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.1.0.5
    • 5.2.0
    • tapestry-core
    • None

    Description

      Tapestry currently has no API to control in what order initialization JavaScript occurs; in fact, much of the initialization (when using RenderSupport.addInit()) will be in an arbitrary order (determined by Map key traversal, which is unpredictable).

      It would be nice if there was some control to ensure that certain initializations occurred before or after others.

      A canonical example is a mixin that adds a confirmation dialog to a link; that event handler for the dialog must come FIRST before any other event handlers for the click event of the link. Since Prototype doesn't seem to provide a way to establish that ordering, Tapestry needs to.

      RenderSupport.addInit() needs new overrides (or perhaps a new method, addScheduledInit()) where a prioritization is added; the priority is a number; all initializations for a particular priority level occur before initializations for a numerically higher level. The default priority should be some reasonable number (0, 100, 1000 ... but fixed) to make it easier to say "before" or "after" ... much as the CSS z-order property is used.

      Attachments

        Activity

          People

            hlship Howard Lewis Ship
            hlship Howard Lewis Ship
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: