Hi TJ,
thx for your reply... actually you were right, the problem was
somewhere else.
i am parsing a <UL><LI>... (the actual (play)list) with <DL>s (the
track's spec) in it.
although, there is definetly no whitespace inside the source code (at
this place),
in IE7, an additional " " (space) was added to my keys!!!
wired enough, this only happens in IE7, all other IEs (6,8,9) and
browsers behave as
expected... :S
guess, if i'd wrapped my output with a <pre>, i would have noticed
this extra whitespace earlier :(
Am 28.03.2011 um 21:28 schrieb T.J. Crowder:
Hi,
Can you put together a minimalist, self-contained example that
demonstrates the problem and post it to jsbin.com or jsfiddle.net or
something? (You can't use document.write there, but you can append
paragraphs to the page or some such.)
yeah, i know and, of course, i did so (angel). i just had minimized
the code down to
the point where this 'error' seemed to occur first.
BTW, your code to loop through the `aPlaylist` array isn't quite right
(but I don't think that's the actual problem). If you use `for..in` to
loop through the array's elements, you have to do some checks because
arrays can have properties other than array indexes, which will break
your code. Details here:
http://blog.niftysnippets.org/2010/11/myths-and-realities-of-
forin.html
Fundamentally, I don't see a problem other than the above with what
you've quoted. Seems to work:
http://jsbin.com/ulesa4
HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com
never the less, thx a lot for your efforts
YT
BB
[ Björn Bartels ]
[ email : bbd...@googlemail.com ]
[ home : http://dragon-projects.de ]
[ skype : bb-drummer ]
[ icq : 283827160 ]
On Mar 28, 3:21 pm, Björn Bartels <bbd...@googlemail.com> wrote:
hi there,
i know this is generic JS und it is only occuring in IE7, but i
hope you can
help me though...
i have an array/list of objects like
[
{
name : 'blah blah',
mp3 : 'http://server.tld/song.mp3',
....
},
.....
]
when i do a for-in loop over such an object, i get its keys and
values as it
should be...
but, the next line, when i try to access the objects' properties
'directly'
like
oTrack.mp3 or oTrack['mp3']
all IE(7) outputs is a unsatisfying 'undefined'... (please, see the
code
below for further details)
any ideas anyone, please?
YT
BB
<code>
for ( iTrack in aPlaylist ) {
var oTrack = aPlaylist[iTrack];
for ( mData in oTrack ) {
document.write('' + iTrack + ', ' + mData + ', ' + oTrack[mData] +
'<br />');
// everything seems fine, all keys, all values
}
document.write('' + iTrack + ', ' + oTrack.mp3 + '<br />'); //
nothing is
fine, outputs 'undefined' for any property
document.write('' + iTrack + ', ' + oTrack['mp3'] + '<br />'); // ...
}
</code>
--
You received this message because you are subscribed to the Google
Groups "Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
.
To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com
.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en
.
--
You received this message because you are subscribed to the Google Groups "Prototype
& script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.