[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wikitech-l
Subject:    Re: [Wikitech-l] [Semediawiki-user] [SRF] - ResourceLoader code breaks d3.js
From:       Jeroen De Dauw <jeroendedauw () gmail ! com>
Date:       2013-05-26 21:21:09
Message-ID: CAMhmagC+74qf8VsY44ExffbR0TjJmq8+ve27hC5J3FzvNq6+bA () mail ! gmail ! com
[Download RAW message or body]

Hey Keith,

This is more a topic for the people that work or have worked on the
resource loader, and thus better suited for the wikitech-l mailing list,
which I have now cc'd.

Cheers

--
Jeroen De Dauw
http://www.bn2vs.com
Don't panic. Don't be evil.
--


On 26 May 2013 14:48, Keith <whyteks@gmail.com> wrote:

> I am developing D3JS reports.
> 
> Using:
> SemanticResultFormats 1.9 alpha
> SemanticMediaWiki 1.9 alpha
> MediaWiki 1.19.6
> 
> I was developing with
> $wgResourceLoaderDebug = true;
> in LocalSettings.php and discovered that things broke when I turned that
> off.
> 
> Iron gave me this error:
> 
> Uncaught SyntaxError: Unexpected token ) load.php:62
> <
> http://qqw/load.php?debug=false&lang=en-gb&modules=ext.cite%2Crtlcite%7Cext.d3.core% \
> 7Cext.srf.qqw%7Cjquery.checkboxShiftClick%2CfootHovzer%2CmakeCollapsible%2Cmw-jump%2 \
> Cplaceholder%2Ctooltip%7Cmediawiki.action.watch.ajax%7Cmediawiki.api%2Cdebug%2Cuser% \
> 7Cmediawiki.api.watch%7Cmediawiki.debug.init%7Cmediawiki.page.ready&skin=vector&version=20130526T095551Z&*
> 
> > 
> 
> and Firefox:
> 
> Error: SyntaxError: function statement requires a name
> Line: 62, Column: 8
> Source Code:
> function(x){var j=d3.bisect(domain,x,1,k)-1;return i[j](u[j](x));};}
> 
> I tracked it down to line 2436 in resources/jquery/d3/d3.v3.js   -
> Version 3.0.4 is bundled with SRF 1.9a
> 
> while (++j <= k) {
> u.push(uninterpolate(domain[j - 1], domain[j]));
> i.push(interpolate(range[j - 1], range[j]));
> }
> return*<load.php is line breaking HERE>* function(x) {
> var j = d3.bisect(domain, x, 1, k) - 1;
> return i[j](u[j](x));
> };
> 
> Now, the d3.js code reads ok to me, so I assume it is some unfortunate
> coincidence that just happens to line break right there where it should
> not.
> 
> I first added a throwaway line at 2436 (foo=bar;) and that fixes it.
> Then I replaced d3.js with version 3.1.8 of and that is also OK.
> Also, of course, leaving $wgResourceLoaderDebug = true; in
> LocalSettings.php is a work around.
> 
> So, this is just a heads up that something is broken in that load.php
> minifying code. I haven't looked at it at all. I'm just prototyping
> stuff for D3JS and SMW/SRF at the moment. I'm really "doing my own
> thing" but after I get my required functionality I might look at
> mediawiki-ifying my code. I currently have some forced-directed graphs
> working from Special:Ask.
> 
> I notice that the problem does not occur with any of the other D3 graphs
> that are implemented in SRF.
> I took a quick look at the output of load.php with these resources and
> effectively, that line break is not occuring in the sameplace.
> 
> I can't figure out what is causing the problem.
> 
> 
> Keith.
> 
> _______________________________________________
> Semediawiki-user mailing list
> Semediawiki-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
> 
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic