473,880 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is wrong with the arr.slice(x, y) in IE6?

Hi,

I was wondering whether someone could enlighten me as to the reason why the
slice does not work in IE when the arr is passed in properly.
Checked the values in the srcArr and they are correct so no problems there.
Gecko works as expected.
Prior to entering the function I can slice the array being entered so I
wouldn't expect an "Unexpected call to method or property access" (in IE 6).

I guess its something silly but as of yet i'm not seeing it.
Any suggestions would be appreciated.

TIA
Fermin DCG

=============== =============== =====
function insertIntoArray (srcArr, insLoc, repl, insObj) {
alert(srcArr.sl ice(0,2));
var top = (repl) ? srcArr.slice(0, insLoc) : srcArr.slice(0, insLoc1);
var end = (repl) ? srcArr.slice(in sLoc+1) srcArr.slice(in sLoc+1);
return top.concat(insO bj, end);
}
Jul 20 '05 #1
4 2937
"F. Da Costa" <da*****@xs4all .nl> writes:
I was wondering whether someone could enlighten me as to the reason
why the slice does not work in IE when the arr is passed in properly.
It works for me. Need more detail.
Checked the values in the srcArr and they are correct so no problems there.
What is the correct value?
Gecko works as expected.
What is the expected result?
Prior to entering the function I can slice the array being entered so
I wouldn't expect an "Unexpected call to method or property access"
(in IE 6).
Ok. Do you slice it?
I guess its something silly but as of yet i'm not seeing it.
Any suggestions would be appreciated.
function insertIntoArray (srcArr, insLoc, repl, insObj) {
alert(srcArr.sl ice(0,2));
var top = (repl) ? srcArr.slice(0, insLoc) : srcArr.slice(0, insLoc1);
Undefined variable "insLoc1", should be "insLoc" or "insLoc+1"? If
"insLoc", the branches are equal. If "insLoc+1", the insObj is
inserted *after* the insLoc'th element.
var end = (repl) ? srcArr.slice(in sLoc+1) srcArr.slice(in sLoc+1); ^ missing ":"

The branches are equal, so no need for conditional expression.
return top.concat(insO bj, end);
}


The code is syntactically incorrect. Please post the actual code that
fails, and say what you do (the actual values of the arguments that
fail), what you expect to happen (the final result, or even the vlaues
of top and end), and what actually happens.

Then I'm sure we will be able to help you. Until we have that information,
all we can do is guess (and while it sometimes seems that way, we are not
oracles :)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Lasse Reichstein Nielsen wrote:
The code is syntactically incorrect. Please post the actual code that
fails, and say what you do (the actual values of the arguments that
fail), what you expect to happen (the final result, or even the vlaues
of top and end), and what actually happens. I understand, so i'll first present the html code from where the call is
made followed by the js code used.
Note:
Working env contains two frames. 1 for scripts (like a library with
accessible variables) & the other for showing content.
Clicking on a link gets one into the page as shown below.

Verified:
The existence (with contents) of *top.frmScripts ._skeleton*.
The creation and fill of *arr*.
IE immediately jumps to the last render <script> whilst Gecko goes in and
comes back with an extended *top.frmScripts ._skeleton* (which is what i
intended for it to do).
Entering the function goes as planned & all the variables are filled as
expected. Also did an alert() check in IE.
The monment it hits the slice statement it falls over on the first slice
request. So it does *not* slice in the alert.

My feeling (for what its worth):
It is almost as if there is something of a type change. From Array to
something that does *not* support the slice method (judging by the error
reported, Unexpected call to method or property access).

I hope this is complete enough to help me underatand what i'm doing wrong.
=== .html ===
<body>
<div id="doc">
<h3>This is the MAIN div</h3>
<script>
var arr = new Array();
arr.push('<tbod y id="ognl:script Parameter">');
arr.push('<tr>< td >row-0 -:- col-0</td><td>row-0 -:-
col-1</td></tr><tr><td>row-1 -:- col-0</td><td>row-1 -:-
col-1</td></tr><tr><td>row-2 -:- col-0</td><td>row-2 -:- col-1</td></tr>');
arr.push('</tbody>');

top.frmScripts. _skeleton = insertIntoArray (top.frmScripts ._skeleton,
top.frmScripts. getTbodyIndexBy Id(top.frmScrip ts._skeleton, 'tb1'), true, arr);
var skeleton = top.frmScripts. _skeleton;
</script> Just processed tb1

<script>
var skeleton = top.frmScripts. _skeleton;
alert("Main::pr e render skel.len: "+skeleton.leng th);
for (var i=0, len=skeleton.le ngth; i<len; i++)
document.write( skeleton[i]);
skeleton = null;
</script>
</div>
</body>

=== CreateTbody.js === can be found in the frame called frmScripts
function getTbodyIndexBy Id(tableSkeleto n, tbodyID) {
for (var i=0, len=tableSkelet on["length"]; i<len; i++) {
if (tableSkeleton[i].indexOf(tbodyI D)>1) return i;
}
return 0;
}

/**
* This function can be used to insert an element or another array into an
array.
* @param sourceArray = the array into which one wants to do the insertion
* @param insertLocation = the location (int) where the insertion needs to
take place
* @param replace = boolean indicating what should happen to the element
on insertLocation
* @param insertObject = the object (string || array) to be inserted
*
* @return the array with the inserted data
*/
function insertIntoArray (sourceArray, insertLocation, replace, insertObject) {
alert("insert:: slice test = "+tmp.slice(0,2 ));
var top = (replace) ? sourceArray.sli ce(0, insertLocation) :
sourceArray.sli ce(0, insertLocation+ 1);
var end = (replace) ? sourceArray.sli ce(insertLocati on+1) :
sourceArray.sli ce(insertLocati on+1);
return top.concat(inse rtObject, end);
}
all we can do is guess (and while it sometimes seems that way, we are not
oracles :)

If not that then definitely 'see-ers' ;)

TIA
Fermin DCG
Jul 20 '05 #3
Lasse Reichstein Nielsen wrote:
It works for me. Need more detail.

Has cost me a whole Sunday trying to figure it out.
Still not resolved but I found an Array extension (prototypes) to include
missing function to IE and that *did* make it work.

I attached the file I found on the web that resolved the whole thing
(obviously you won't benefit but others might ;))

I would like to thank you however for the effort you made to react back.

Cheers,
Fermin DCG
Jul 20 '05 #4
F. Da Costa wrote:
I attached the file I found on the web that resolved the whole thing
(obviously you won't benefit but others might ;))


Please never ever do this again. Attachments in a non-binary group like
this are a Bad Thing. People subscribe to non-binary groups because
they want text content and *small* messages only. Besides, a .js file,
when displayed inline -- and yours should be:

| --------------040106080409010 602080206
| Content-Type: application/x-javascript;
| name="ArrayExte nsion.js"
| Content-Transfer-Encoding: 8bit
| Content-Disposition: inline;
| filename="Array Extension.js"

--, could be easily executed. Hopefully nobody has scripting enabled
for his/her newsreader app, otherwise viruses/worms could be easily
distributed, since many people use a e-mail/news client combo. Or they
get a script error due to a restricted DOM or bad syntax, unwished as well.

Post a URI for the file instead, most newsreaders will make it a
hyperlink. Or tell people to send you mail if they want the source
code (another reason why one should post with a valid e-mail address).
Or post it as plain text if it does not exceed, say, 100 lines.

Thanks.
PointedEars
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

108
6501
by: Bryan Olson | last post by:
The Python slice type has one method 'indices', and reportedly: This method takes a single integer argument /length/ and computes information about the extended slice that the slice object would describe if applied to a sequence of length items. It returns a tuple of three integers; respectively these are the /start/ and /stop/ indices and the /step/ or stride length of the slice. Missing or out-of-bounds indices are handled in a manner...
40
2633
by: Ron Adam | last post by:
After considering several alternatives and trying out a few ideas with a modified list object Bengt Richter posted, (Thank You), I think I've found a way to make slice operation (especially far end indexing) symmetrical and more consistent. So to find out if this is indeed a possibility, it would be nice to get a few opinions at this point. So blast away... or hopefully tell me what you like about it instead. ;-) (Any suggestions or...
0
1596
by: Clemens Hintze | last post by:
Hello, I have a question concerning the usage of default constructed std::slice instances. Our company currently validate the GNU-G++ 3.4 compiler against the ISO/IEC 14882:2003 standard for compliance. We are using a commercial testsuite that is sold explicitely for such validation purposes. Now there occurs a problem, where the corresponding test produces a
1
4293
by: cylin | last post by:
Dear all, I am a newbie using lex and yacc. I really don't know what's wrong with my code, because the output is not what I want. My yacc rules don't match, and yylex seems just read only one line of the text file. Please help...thx.
23
2355
by: Antoon Pardon | last post by:
Now slices are objects in python, I was wondering if slice notation will be usable outside subscribtion in the future. Will it ever be possible to write things like: a = 4:9 for key, value in tree.items('alfa.': 'beta.'): -- Antoon Pardon
17
3585
by: baibaichen | last post by:
i have written some code to verify how to disable slicing copy according C++ Gotchas item 30 the follow is my class hierarchy, and note that B is abstract class!! class B { public: explicit B(INT32 i =0):i_(i){} virtual ~B(){}
2
7259
by: smichr | last post by:
It seems to me that the indices() method for slices is could be improved. Right now it gives back concrete indices for a range of length n. That is, it does not return any None values. Using an example from clpy about this the indices for a 'None, None, -2' slice for a range of length 10 are given as '9, -1, -2'. The problem is that these concrete values cannot be fed back into a slice so that a slice will extract the same elements that...
7
1952
by: RubyRedRick | last post by:
I bought Crockford's "JavaScript: The Good Parts" yesterday to help build my JavaScript foo. On page 44, he gives an implementation of the curry function: Function.method('curry', function() { var slice = Array.prototype.slice, args = slice.apply(arguments), that = this;
5
2206
by: Mike Kent | last post by:
For Python 2.5 and new-style classes, what special method is called for mylist = seq and for del mylist (given that mylist is a list, and seq is some sequence)? I'm trying to subclass list, and I'm having trouble determining what special methods I have to override in my class for the above two operations. From my testing, it seems to be __setslice__ for both, but the docs say __setslice__ and brethren are deprecated. I would have...
0
11089
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10809
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9550
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7948
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7104
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5777
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5972
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4192
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.