You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Paul Stanton (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2012/04/17 08:51:21 UTC

[jira] [Issue Comment Edited] (TAP5-1907) ie9 javascript error when partial render includes stylesheets

    [ https://issues.apache.org/jira/browse/TAP5-1907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13255366#comment-13255366 ] 

Paul Stanton edited comment on TAP5-1907 at 4/17/12 6:50 AM:
-------------------------------------------------------------

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.
                
      was (Author: paul.stanton):
    actually, the 'scripts' are ok - embedded scripts return "" for href, however the extra filter can't hurt.
                  
> ie9 javascript error when partial render includes stylesheets
> -------------------------------------------------------------
>
>                 Key: TAP5-1907
>                 URL: https://issues.apache.org/jira/browse/TAP5-1907
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.2
>            Reporter: Paul Stanton
>            Priority: Critical
>              Labels: ajax, internetexplorer, scripts
>
> 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();

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira