philogb / jit

The JavaScript InfoVis Toolkit provides tools for creating Interactive Data Visualizations for the Web
http://thejit.org
Other
1.51k stars 297 forks source link

jit-1.1.3-238-gea8e451 totally broken in IE 6/8 #29

Closed longsoft-dev closed 14 years ago

longsoft-dev commented 14 years ago

Check out the latest version as of Jun 17 2010, run Python 2.6.5: > python make.dos.py examples

Then in the generated Examples directory run any example?.html, it works in Firefox and Chrome, but broken in IE 6/8.

For someone who is interested, make.dos.py is a copy of make.py except that some system commands were replaced with those of windows, contents as following:

include libraries

from os import system, walk from shutil import copy import sys, re

from tests import tests_model from serve import render from build import Build

YC = 'yuicompressor-2.4.2.jar' EXCLUDES = ['Source/Extras', 'Source/Layouts', 'Source/Options/Options.js' 'Source/Core/Fx.js', 'Source/Graph/Graph.Geom.js']

def main(): if 'docs' in sys.argv: make_docs() if 'examples' in sys.argv: make_examples() if 'examples-fancy' in sys.argv: make_examples(fancy=True) if 'build' in sys.argv: make_build() if 'build-fancy' in sys.argv: make_build(fancy=True)

def make_docs(): system("perl "

def make_examples(fancy=False):

clean examples folder

system("md Examples")

copy css base files

system('xcopy Tests\\css Examples\\css /e/i/y')

iterate over the examples

for viz, tests in tests_model.items():

create example folder

    system('md Examples\\' + viz)
    count = 1
    for i, model in enumerate(tests):
        if 'Example' in model and model['Example']:
            make_example(viz, model, i, count, fancy)
            count += 1

copy some extra files

if fancy:
    system('xcopy Extras\\sh Examples\\ /e/i/y')
    system('copy Extras\\code.css Examples\\css\\code.css')

def make_example(viz, ex, i, count, fancy):

name = viz
stri = str(i + 1)
model = ex
title = model['Title']
extras = model['Extras'][:]
example = 'example' + str(count)
strdir = 'Examples/' + viz + '/'

insert the example js file

fcommon = open('Tests/js/common.js', 'r')
ftest = open('Tests/' + viz + '/test' + stri + '.js', 'r')
fout = open(strdir + example + '.js', 'w')
fout.write('\n\n'.join([fcommon.read(), ftest.read().replace('/Tests/css', '../css')]))
fcommon.close()
ftest.close()
fout.close()

render the html file

includes = {
    'left':  getattr(render['TestCases'], viz + '/' + 'left')(model, viz, 1, 1),
    'right': getattr(render['TestCases'], viz + '/' + 'test' + stri)(model),
}

fhtml = open(strdir + example + '.html', 'w')
html = render['TestCases'].baseexamples(name, title, extras, example, '', includes, fancy).__body__
fhtml.write(html)
fhtml.close()

create syntax highlighted code page

if fancy:
    begin, end, res = re.compile("[\s]*//init ([a-zA-Z0-9]+)[\s]*"), re.compile('[\s]*//end[\s]*'), []
    ftest = open('Tests/' + viz + '/test' + stri + '.js', 'r')
    for l in ftest:
        if begin.match(l):
            name, lines = begin.match(l).group(1), []
            for blockline in ftest:
                if end.match(blockline): break
                lines.append(blockline)

            res.append({
                'name': name,
                'code': ''.join(lines)
            })

    fcode = open(strdir + example + '.code.html', 'w')
    html = render['TestCases'].basecode(name, title, res, example).__body__
    fcode.write(html)
    fcode.close()

def make_build(fancy=False): system('del /q Jit*') print "Building Examples..." make_examples(fancy) system('xcopy Examples Jit /e/y') print "Done. Building Extras..." system('md Jit\Extras && copy /y Extras\excanvas.js Jit/Extras\excanvas.js') print "Done. Building Library..." lib = Build().build() license = open('LICENSE', 'r').read() f = open('Jit/jit.js', 'w') f.write(license) f.write(lib) f.close() print "Done. Compressing Library..." f = open('Jit/jit-yc.js', 'w') f.write(license) f.close() system('java -jar Extras/' + YC + ' Jit/jit.js >> Jit/jit-yc.js') print "Done. Zipping..." system('del Jit.zip') system('C:\utils\7-Zip\7z.exe a Jit.zip Jit/') print "Done, I guess." if name == "main": main()

philogb commented 14 years ago

Hi,

The examples aren't supposed to be built that way. If you want to check out the visualization tests (the examples are included in the tests) then you can read this wiki: http://wiki.github.com/philogb/jit/getting-started . If you want to create an entire build of the toolkit then you should execute

 python make.py

And a folder with the examples will be created (in Linux/Mac).

longsoft-dev commented 14 years ago

Hi, I guess you missed some point of my comment. Instead of python make.py I run python make.dos.py examples because I'm using Windows. Anyway, have you tried the visualization in IE?

philogb commented 14 years ago

Yes, but the examples command creates an Examples folder that doesn't work like you'd expect because the examples keyword is not supposed to be used without creating an entire build afterwards :) Yes I did test the examples with a complete build and they seem to work fine. You just have to include the excanvas.js file found in the Extras folder. Perhaps you can hand-code the path to that file in the Examples folder you created with make.dos.py.

longsoft-dev commented 14 years ago

Hi philogb, I would be surprised if you passed the test in IE 6. I traced the problem and found it was actually caused by the extra comma in line 307 of Icicle.js. As indicated in http://github.com/philogb/jit/issues#issue/27, this breaks IE as IE is very picky about the syntax. After I fixed that, it worked in IE now.

FYI, the way I built examples also works a treat probably because I forgot to tell you that before run python make.dos.py examples, I have also run python build.py > jit.js :)

philogb commented 14 years ago

Thanks a lot for the heads up :)