ICEfaces
  1. ICEfaces
  2. ICE-6860

Refactor node lookup in animation Javascript code

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0, 2.0.1, EE-2.0.0.GA
    • Fix Version/s: 2.1-Beta, 3.0, EE-2.0.0.GA_P01
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      any

      Description

      Motivated by portlets support, the default Y.one() function was overridden to escape ':'s in the IDs passed to it. This didn't completely work in some cases, and it could cause problems if IDs are escaped again at different points in the code. A better approach would be to get the DOM elements via document.getElementById() and pass the element to Y.one() to avoid problems with IDs that contain ':'s. This practice needs to be consistent throughout the animation code to make the code less confusing and less error-prone.

        Activity

        Hide
        Arturo Zambrano added a comment -

        The reasons why the original approach to escaping ':'s in IDs wasn't having the desired effect were that, in Javascript, String.replace() only replaces the first occurrence of the substring, so it was necessary to use a regex with the global modifier instead to replace all occurrences. The other reason was that the code that overrides the default Y.one() function to support ':'s in ID's stopped having an effect after a previous refactoring related to reducing calls to ice.yui3.use(). This code was moved to a more appropriate place, just after loading the required dependencies. Thus, we'll keep using Y.one() directly without first using document.getelementById(), since now things work as desired.

        Committed fix to 2.0 maintenance branch to revision 24574.

        Show
        Arturo Zambrano added a comment - The reasons why the original approach to escaping ':'s in IDs wasn't having the desired effect were that, in Javascript, String.replace() only replaces the first occurrence of the substring, so it was necessary to use a regex with the global modifier instead to replace all occurrences. The other reason was that the code that overrides the default Y.one() function to support ':'s in ID's stopped having an effect after a previous refactoring related to reducing calls to ice.yui3.use(). This code was moved to a more appropriate place, just after loading the required dependencies. Thus, we'll keep using Y.one() directly without first using document.getelementById(), since now things work as desired. Committed fix to 2.0 maintenance branch to revision 24574.

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Arturo Zambrano
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: