Coder Social home page Coder Social logo

Comments (9)

ippa avatar ippa commented on August 28, 2024

good find! .. actually your demo works just fine in both latest chrome and ie9 but fails (failing as in list[0] contains element1) in firefox 9 (and I assume earlier versions as well).

But of course it needs to work in firefox as well. Do you think some simpler patch is possible to solve this issue, maybe setting list[x] to undefined manually where it matters? Probably a bad solution though.

A patch from someone who spent time digging into the issue sounds very good in my ears :). I would most certainly accept it.. some tests for this would kick ass as well. I wouldn't mind having the internal array be called sprites.. cause what does a SpriteList contain if not sprites :). Also let's try not to break any documented APIs.. but I don't think that should be so hard.

from jaws.

dmitrizagidulin avatar dmitrizagidulin commented on August 28, 2024

Heh, that was my first thought too -- calling 'delete' so that list[x] is set to undefined.. and then wrapping the draw() invocation on each sprite in a if(this[i]) { this[i].draw() }.

(Also, I was /wondering/ if this might be a browser-specific issue, too! I see)

But.. I mean, if the language protests against subclassing Array, then fine, let's not. Let me get a patch together (with unit tests, definitely), see what you think.

from jaws.

dmitrizagidulin avatar dmitrizagidulin commented on August 28, 2024

I copy on the internal array being called 'sprites', btw. :)

from jaws.

dmitrizagidulin avatar dmitrizagidulin commented on August 28, 2024

Oh hey, question. Do all the current unit tests for jaws pass for you, for all browsers? (I'm working on adding some, to deal with the array issue right now).
All of the current ones pass for me in Firefox 9, but I'm getting failures in Chrome 16 and IE 9 (on windows)

from jaws.

ippa avatar ippa commented on August 28, 2024

works 100% for in me in chrome.. in ie9 and ff there was some kind of race condition producing a lot of errors, I think I fixed it now.

I only get one failing test in ie9/ff now, and that's "audio loaded".. not sure why the .wav-file isn't loaded correctly just yet.

from jaws.

dmitrizagidulin avatar dmitrizagidulin commented on August 28, 2024

Question. In sprite_list.js, in the constructor:

jaws.SpriteList = function SpriteList(options) {
  if( !(this instanceof arguments.callee) ) return new arguments.callee( options );

What is that second line (re arguments/callee etc) for? I think I understand what it's saying, but what situation does it come useful in?

from jaws.

ippa avatar ippa commented on August 28, 2024

it makes both sprite_list = new SpriteList() and sprite_list = SpriteList() work

.. basically it will make the constructor work without "new". arguments.callee is just a more general way of writing SpriteList.

from jaws.

dmitrizagidulin avatar dmitrizagidulin commented on August 28, 2024

One more - what's your policy on tabs vs spaces, in contributed code? (tab chars ok, or do you want '2 spaces' tabs, or what?)

from jaws.

ippa avatar ippa commented on August 28, 2024

2 spaces

from jaws.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.