Tapestry 5
  1. Tapestry 5
  2. TAP5-1882

Ajax doesn't work anymore after inserting inline style in IE9

    Details

      Description

      We're using a progress spinner (http://fgnass.github.com/spin.js/) which inserts an inline style via JS in our application.
      When a ajax response is processed the href attribute of all the stylesheets gets rebuilt if the agent is IE.
      The problematic lines are (beginning line 2042 in tapestry.js:

      tapestry.js
      addStylesheets : function(stylesheets) {
         if (!stylesheets)
            return;
         
         var _ = T5._;
         var loaded = _(document.styleSheets).chain().pluck("href").without("").map(this.rebuildURLIfIE).value();
      ...
      
      rebuildURLIfIE :
         Prototype.Browser.IE ? Tapestry.rebuildURL : T5._.identity, 
      

      In IE8 the empty/missing href in the inline style tag evaluates to an empty string ("") which is correctly removed by without(""), in IE9 instead it's evaluated to null.
      rebuildURLIfIE evaluates to Tapestry.rebuildURL for IE, when a href equals to null an exception is thrown as soon as the path parameter is accessed:

      tapestry.js
      rebuildURL : function(path) {
         if (path.match(/^https?:/)) {
            ...
      

      The issue can be easily fixed by adding without(null) above line:

      tapestry.js
         ...
         var loaded = _(document.styleSheets).chain().pluck("href").without("").without(null).map(this.rebuildURLIfIE).value();
         ...
      

      In FF the problem would be the same as an empty href in the style tag also evaluates to null, still the problem doesn't appear as the attribute is only rebuild for IE.

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          149d 14h 26m 1 Howard M. Lewis Ship 18/Aug/12 01:14
          Howard M. Lewis Ship made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Howard M. Lewis Ship [ hlship ]
          Resolution Duplicate [ 3 ]
          Hide
          Howard M. Lewis Ship added a comment -

          Yes, fixed as TAP5-1907.

          Show
          Howard M. Lewis Ship added a comment - Yes, fixed as TAP5-1907 .
          Hide
          Ray Nicholus added a comment -

          I'm seeing the same issue when using modernizr js. I documented it here: http://tapestry.1045711.n5.nabble.com/exception-in-IE-on-ajax-request-td5714077.html

          Show
          Ray Nicholus added a comment - I'm seeing the same issue when using modernizr js. I documented it here: http://tapestry.1045711.n5.nabble.com/exception-in-IE-on-ajax-request-td5714077.html
          Jochen Kemnade made changes -
          Field Original Value New Value
          Link This issue is related to TAP5-1907 [ TAP5-1907 ]
          Matthias Melitzer created issue -

            People

            • Assignee:
              Howard M. Lewis Ship
              Reporter:
              Matthias Melitzer
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development