Tapestry 5
  1. Tapestry 5
  2. TAP5-1907

Client exception in IE9 when partial page render introduces stylesheets

    Details

      Description

      I've found an incompatibility with ie9 and tapestry exposed when an ajax response renders a component(s) which include their own stylesheets.

      This will call Tapestry.ScriptManager.addStylesheets.

      The offending line 2048 in tapestry.js
      var loaded = _(document.styleSheets).chain().pluck("href").without("").map(this.rebuildURLIfIE).value();

      The problem is within
      map(this.rebuildURLIfIE)

      which is calling with a null path:
      rebuildURL : function(path) {
      if (path.match(/^https?:/))

      { return path; }

      ...

      Turns out, in ie9 (unlike all other browsers) the embedded stylesheets have a null href, not "" therefore the without("") does not filter the blank entries.

      The solution is to add a call to without(null) before calling map.

      However, this line is way too complicated to be on one line so I would recommend splitting it into 3 (at least):

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

      The same must be done for addScripts (line 2021):

      var resources = _(document.scripts).chain().pluck("src");
      resources = resources.without("").without(null);
      var loaded = resources.map(this.rebuildURLIfIE).value();

        Issue Links

          Activity

          Paul Stanton created issue -
          Hide
          Paul Stanton added a comment - - edited

          Actually, the 'scripts' are ok - embedded scripts return "" for href, however the extra filter can't hurt.

          Also, it seems this is only a problem when the tapestry page in question is loaded via an IFRAME.

          Show
          Paul Stanton added a comment - - edited Actually, the 'scripts' are ok - embedded scripts return "" for href, however the extra filter can't hurt. Also, it seems this is only a problem when the tapestry page in question is loaded via an IFRAME.
          Jochen Kemnade made changes -
          Field Original Value New Value
          Link This issue relates to TAP5-1882 [ TAP5-1882 ]
          Hide
          Jochen Kemnade added a comment -

          These issues seem to be related.

          Show
          Jochen Kemnade added a comment - These issues seem to be related.
          Hide
          Paul Stanton added a comment -

          the solution is the same so must be a duplicate. sorry my search didn't return the other bug when i created this.

          Show
          Paul Stanton added a comment - the solution is the same so must be a duplicate. sorry my search didn't return the other bug when i created this.
          Howard M. Lewis Ship made changes -
          Summary ie9 javascript error when partial render includes stylesheets Client exception in IE9 when partial page render introduces stylesheets
          Labels ajax internetexplorer scripts ajax ie internetexplorer scripts
          Howard M. Lewis Ship made changes -
          Labels ajax ie internetexplorer scripts ajax fixed-in-5.4-js-rewrite ie internetexplorer scripts
          Fix Version/s 5.3.5 [ 12322440 ]
          Howard M. Lewis Ship made changes -
          Fix Version/s 5.3.6 [ 12322961 ]
          Fix Version/s 5.3.5 [ 12322440 ]
          Howard M. Lewis Ship made changes -
          Fix Version/s 5.3.5 [ 12322440 ]
          Fix Version/s 5.3.6 [ 12322961 ]
          Hide
          Michael Wyraz added a comment -

          There's a similar line in addScripts - i wonder if this should have added "without(null)" as well?

          Show
          Michael Wyraz added a comment - There's a similar line in addScripts - i wonder if this should have added "without(null)" as well?
          Howard M. Lewis Ship made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Fix Version/s 5.4 [ 12316401 ]
          Hide
          Hudson added a comment -

          Integrated in tapestry-trunk-freestyle #977 (See https://builds.apache.org/job/tapestry-trunk-freestyle/977/)
          TAP5-1907: Client exception in IE9 when partial page render introduces stylesheets (Revision 798b787722dd23e33c4f190d6d37e0c3c10b740d)

          Result = FAILURE
          hlship :
          Files :

          • tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee
          Show
          Hudson added a comment - Integrated in tapestry-trunk-freestyle #977 (See https://builds.apache.org/job/tapestry-trunk-freestyle/977/ ) TAP5-1907 : Client exception in IE9 when partial page render introduces stylesheets (Revision 798b787722dd23e33c4f190d6d37e0c3c10b740d) Result = FAILURE hlship : Files : tapestry-core/src/main/coffeescript/META-INF/modules/core/pageinit.coffee

            People

            • Assignee:
              Unassigned
              Reporter:
              Paul Stanton
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development