FLUID-4109: layoutReorderer demo has a "demo is not defined" error on load

Metadata

Source
FLUID-4109
Type
Bug
Priority
Critical
Status
Closed
Resolution
Fixed
Assignee
N/A
Reporter
Harris Wong
Created
2011-02-23T15:44:06.242-0500
Updated
2011-06-06T17:52:37.416-0400
Versions
  1. 1.3.1
Fixed Versions
  1. 1.4
Component
  1. Demos
  2. Layout Reorderer

Description

1. Download the "infusion-InfusionAll-1.3.1-src.zip" from http://wiki.fluidproject.org/display/fluid/Release+Package+QA+Test+Plan
2. Run infusion-InfusionAll-1.3.1-src/demos/reorderer/layoutReorderer/demo.html
3. Get the following error:

Error: demo is not defined
Source File: http://localhost/fluid/infusion_diff/infusion-InfusionAll-1.3.1-src/demos/reorderer/layoutReorderer/html/layoutReorderer.html
Line: 138

This could be an url rewriting problem in the the build process.

Adding "<script type="text/javascript" src="../js/layoutReorderer.js"></script>" in demos/reorderer/layoutReorderer/html/layoutReorderer.html line 15 would fix the problem.

Environments

WinXP FF, IE8

Attachments

Comments

  • Justin Obara commented 2011-05-17T09:42:59.428-0400

    Bug Parade Infusion

  • Harris Wong commented 2011-05-30T15:30:17.647-0400

    In master, "<script type="text/javascript" src="../js/layoutReorderer.js"></script>" is already added in demos/reorderer/layoutReorderer/html/layoutReorderer.html. Check the 1.4-src again before resolving.

  • Harris Wong commented 2011-06-02T14:46:34.415-0400

    Run ant infusionAllBuilds, then you will get the error. Screen shot layoutReorderer-error.png attached.

  • Harris Wong commented 2011-06-02T17:00:24.942-0400

    Seems like build.js's that.buildJSReplaceRegExpression() is striping <script></script> tags blindly. It might be a reason why listReorderer, layoutReorderer tags got stripped.

  • Harris Wong commented 2011-06-03T10:38:31.811-0400

    In build.js, buildRegExpression returns the regExpression with the following:
    <script{1,1}?.*Reorderer\.js{1,1}?.*script>

    This will match the demo's reorderer's links, such as the following:
    <script type="text/javascript" src="../js/layoutReorderer.js"></script>
    <script type="text/javascript" src="../js/listReorderer.js"></script>
    <script type="text/javascript" src="../js/<prefix>Reorderer.js"></script>

  • Harris Wong commented 2011-06-03T15:19:30.128-0400

    Problem: Regular expression allows the script to remove any string that has "Reorderer.js" in it. It was designed to remove components "LayoutReorderer.js", "ListReorderer.js", "ImageReorderer.js" dynamically; however it also removes "layoutReorderer.js" which is not supposed to. This only affect demos with custom build using the build-scripts.

    Possible solutions:
    1. Change the demo js files name; ie. change layoutReorderer.js to layoutReordererDemo.js. This doesn't prevent future demo from breaking though.
    2. Change the regular expression sightly to match "<script{1,1}?.<componentName>\.js{1,1}?.*script>" to "<script{1,1}?.\/<componentName>\.js{1,1}?.*script>" so it will only remove components related js files. However this doesn't prevent users from using component name as the demo js, ie. LayoutReorderer.js instead of layoutReorderer.js.
    3. Match the <componentName> to a list of component and remove it iff the component is on the list. This list needs to be updated per new component added, making it hard to maintain.

    Discussed with Justin, we believe it's better to add a directory separator in front of the filename(opt #2) for now.

  • Harris Wong commented 2011-06-06T15:20:17.479-0400

    Instead of adding the front slash to the actual build.js, we can modify the rules in the build.xml instead. Change line 18
    <property name="regexStartJS" value="&lt;script{1,1}?.*" /> to
    <property name="regexStartJS" value="&lt;script{1,1}?.*\/" />

  • Justin Obara commented 2011-06-06T17:52:01.914-0400

    Merged into the project repo at a60418a57b88923ff2dd33d61b44c5f49bbeafac

  • Justin Obara commented 2011-06-06T17:52:26.629-0400

    reopening to set the resolution