#135 ✓resolved
Diego Perini

typo in "dom.js" in __toDomNode__ L: 3112

Reported by Diego Perini | March 26th, 2010 @ 11:43 AM

I think there is a typo on this line:

for each(xnode in e4){

removing that extra "each", did let me load "env.js" in V8 and play a bit.

I am using Thatcher fork from GitHub, downloaded just a few days ago.

I found this by just following the error line shown in the V8 console after:

load("env.js");

Comments and changes to this ticket

  • nickg

    nickg March 26th, 2010 @ 04:26 PM

    hi, I hope in short order to be porting or generalizing envjs to work with other engines so I appreciate the ticket.

    this appears to be a odd spidermonkey/rhino extension, although it's claimed to be part of the js1.6 spec, which means it should be part of v8.

    https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Stat...

    i've never used e4x, but it seems that:

       for each(xnode in e4){
        kind = xnode.nodeKind();
    

    could be converted to

    for (xnode_name in e4) {
       kind = xnode[xnode_name];
    

    ??? thoughts welcome here.

  • nickg

    nickg March 26th, 2010 @ 04:26 PM

    sorry that should have been:

    for (xnode_name in e4) {
       kind = xnode[xnode_name].nodeKind();
    

    or something damn similar.

  • nickg

    nickg March 27th, 2010 @ 04:16 AM

    Does this look right to you?

    @@ -33,8 +33,9 @@ var __toDomNode__ = function(e4, parent, doc){
             element,
             kind;
         //console.log('converting e4x node list \n %s', e4)
    -    for each(xnode in e4){
    -        kind = xnode.nodeKind(); 
    +    for (item in e4) {
    +        xnode = e4[item];
    +        kind = xnode.nodeKind();
             //console.log('treating node kind %s', kind);
             switch(kind){
                 case 'element':
    
  • nickg

    nickg March 27th, 2010 @ 04:17 AM

    take 2

     var __toDomNode__ = function(e4, parent, doc){
    -    var xnode, 
    +    var xnode,
             domnode,
             children,
             target,
             value,
             length,
             element,
    -        kind;
    +        kind,
    +        item;
         //console.log('converting e4x node list \n %s', e4)
    -    for each(xnode in e4){
    -        kind = xnode.nodeKind(); 
    +    for (item in e4) {
    +        xnode = e4[item];
    +        kind = xnode.nodeKind();
             //console.log('treating node kind %s', kind);
    
  • nickg

    nickg March 27th, 2010 @ 04:34 AM

    • State changed from “new” to “resolved”
    • Assigned user changed from “Thatcher” to “nickg”
  • Thatcher

    Thatcher March 28th, 2010 @ 10:20 AM

    wow just catching up on this thread. I wasnt sure e4x was supported in V8
    but I'm thrilled to hear it is now! Nice work guys!

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

a javascript browser environment

People watching this ticket

Pages