Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-1907

Client exception in IE9 when partial page render introduces stylesheets

    XMLWordPrintableJSON

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();

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              paul.stanton Paul Stanton
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: