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

          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.
          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.
          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?
          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:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development