Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4362

AJAX reloading of stylesheets does not work with HtmlUnit

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Not A Problem
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None

      Description

      There is an issue with dynamically loading stylesheets when using HtmlUnit.

      In wicket-ajax.js:1624 the following code is used to detect when the stylesheet has loaded:
      // cross browser way to check when the css is loaded
      // taked from http://www.backalleycoder.com/2011/03/20/link-tag-css-stylesheet-load-event/
      // this makes a second GET request to the css but it gets it either from the cache or
      // downloads just the first several bytes and realizes that the MIME is wrong and ignores the rest

      var img = document.createElement('img');
      var notifyCalled = false;
      img.onerror = function() {
      if (!notifyCalled)

      { notifyCalled = true; notify(); }
      }
      img.src = css.href;
      if (img.complete) {
      if (!notifyCalled) { notifyCalled = true; notify(); }

      }

      The trick with the img tag does not work in HtmlUnit and notify will never be called which results in the AJAX response not being parsed successfully.

      This may well be a HtmlUnit problem but I put this on this tracker in case somebody has another solution for the problem that could make it in the next wicket maintenance release. HtmlUnit is somewhat slower with its release plan.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              aka Andreas Kappler
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: