[Proto-Scripty] Re: IE8 compatibility
It might be new in the context of all versions of IE, but it can hardly be a new bug in a browser that hasn't been released yet. ;-) *Obviously* I meant new to the IE line. (And IE8 was released on Thursday, although Microsoft's own Internet Explorer home page is a bit divided about it...) -- T.J. :-) On Mar 23, 3:04 am, RobG rg...@iinet.net.au wrote: On Mar 21, 10:22 pm, T.J. Crowder t...@crowdersoftware.com wrote: [...] @RobG: Then that is a bug in IE 8. It _may_ be. If the OP's statement: On Mar 20, 6:18 am, masterleep bill-goo...@lipa.name wrote: OK, I found this particular one... if you call input_elem.readAttribute('value'); on an input element, and the value is equal to the empty string, then in IE8 the result is null. is taken at face value, and the version of Prototype.js being used is 1.6.0.3 (which is still the latest stable version published on prototypejs.org), it is very likely a bug in IE 8. Half the point of readAttribute it that it ...cleans up the horrible mess Internet Explorer makes when handling attributes[1] In this case the OP is dealing with the value attribute, which is not one of the properties that readAttribute does anything with - it just calls getAttribute, even for IE. and consequently it does a *lot* of processing around the getAttribute call, including (in trunk) several IE8-specific branches. That is a consequence of trying to write a general wrapper for getAttribute, which is known to be buggy. Why not just forget get/ setAttribute altogether? Always possible that that code isn't handling something right. Equally, it's entirely possible that there's a (new) bug in IE8. :-) It might be new in the context of all versions of IE, but it can hardly be a new bug in a browser that hasn't been released yet. ;-) -- Rob --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Prototype causes function with array/for...each to stop working
Hi there, First of all, I have been working now with prototype in combination with scriptalous to create some animations on my website and it's working great and very simple! But, I just discovered that by including the prototype.js scriptalous.js, the function shown below doesn't execute properly anymore. Debugging in Firefox gives no errors but strange behavior, and IE gives me an error with Object not set error, this occurs on the line document.getElementById(allDivs[s]).style.display = 'none'; where s strangely alooks like to be lastindexof. I might get some replys with: So you do use prototype, but don't use it for everything??? I just couldn't find a way to do the same thing in prototype. I hope someone can help me and thank you in advance for your help. Jochem van Grondelle pre function toggle(div) { var allDivs = new Array (divreferenties,divreferentie106,divreferentie107,divreferentie108,divreferentie109,divreferentie110,divreferentie111,divreferentie112,divreferentie113,divreferentie114,divreferentie115,divreferentie116,divreferentie117,divreferentie166,divreferentie209); document.getElementById('refterug').style.display = ''; for(s in allDivs) { document.getElementById(allDivs[s]).style.display = 'none'; } document.getElementById('refempty').style.display = ''; document.getElementById('refempty').style.display = 'none'; document.getElementById(div).style.display = ''; if (div == 'divreferenties') {document.getElementById ('refterug').style.display = 'none';} else {document.getElementById('refterug').style.display = '';} }//]] /pre --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Prototype causes function with array/for...each to stop working
Oooh - don't say there's a post I can answer... At 02:12 -0700 23/3/09, jazzylicious wrote: I might get some replys with: So you do use prototype, but don't use it for everything??? I just couldn't find a way to do the same thing in prototype. ... var allDivs = new Array (divreferenties,divreferentie106,divreferentie107,divreferentie108,divreferentie109,divreferentie110,divreferentie111,divreferentie112,divreferentie113,divreferentie114,divreferentie115,divreferentie116,divreferentie117,divreferentie166,divreferentie209); document.getElementById('refterug').style.display = ''; for(s in allDivs) { document.getElementById(allDivs[s]).style.display = 'none'; } Try this instead: allDivs.each(function(s) { document.getElementById(allDivs[s]).style.display = 'none'; }); Or, even better: allDivs.each(function(s) { $(allDivs[s]).style.display = 'none'; }); -- Cheers... Chris Highway 57 Web Development -- http://highway57.co.uk/ Star Wars won't work. -- Frank Zappa --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Prototype causes function with array/for...each to stop working
Great, thanks for the super duper quick replies --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Element.insert failed on IE
Hi, I use an Ajax request for posting my form. The response of this request is a string which contains HTML tr id=111td/ tdtd../td/tr. This html represents a row of a table, my goal is to add this row to my table. So I use this code: firstRow = $('msg'+colorIndicator); response = xhr.responseText; firstRow.insert({before: response}) $firstRow if the first row of my table. $responde is my ajax response tr id=111td/tdtd../td/tr. This code works on Firefox but not on IE. When I try this on IE, there is no javascript error message and the javascript code following is not executed. Nothing appends... What is the issue ? The fix ? Is it an official bug ? Maybe $response has to be a javascript object instead of a string ? Thanks for your help, djice --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Prototype causes function with array/for...each to stop working
Hi Jochem, You definitely want to look into the following functions: http://www.prototypejs.org/api/enumerable/invoke enables you to hide multiple elements at once, e.g.: $$(.referentie).invoke(hide); // works if you'd add class=referentie to the div elements you want to hide And instead of: document.getElementById('refempty').style.display = ''; You can just do: $(refempty).hide(); Good luck, Maarten Less code and easier to read too :) On 23 mrt, 10:57, jazzylicious joc...@vangrondelle.net wrote: Great, thanks for the super duper quick replies --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Shrinking JS
2009/3/20 Szymon Wilkołazki wilkola...@gmail.com: 2009/3/20 Jeztah webmas...@thecarmarketplace.com: After a little playing ove the last couple of days i came up with a nice easy way of shrinking many js files on the fly into 1 file ... this will speed up load time heavily on heavy javascript loaded sites . the code is php and is very simple .. it also uses http://www.crockford.com/javascript/jsmin.html to achieve its goal ... Now i must say in my tests sites with 3 or less large javascript includes this wil not speed up much - infact it wil be slower ... You should consider a few enhancements: 1. Cache the output file on the disk, and serve it if the source files hadn't changed. Your server will not have to process the files each time, but only when 2. Insert versions of source files to the url, get rid of question mark, use mod_rewrite instead. The browser would request, for example: URI: /loadJs/proto-1603_scripty-182ef_customScripts-rev1234.js And in .htaccess of /loadJs forward all the urls to your js_load_min.php This will give browsers a chance to cache the js files. 3. Add Expires: header, in far future. I usually make it 100 years from now. Combined points 2. and 3. ensures that any user will have to download your js files once and only once, and redownload it only if he cleared his browser cache. The version strings in the URL ensures, that he WILL for sure download a new version if you update the scripts. 4. run a regular expression on all of source files to get /* (c) copyright Comments */ from them, then prepend your minified file with those comments. Not doing that violates most of the open source licenses. GPL for sure, and I'am pretty sure this also applies to MIT and BSD licenses. Implementing all those points will provide a reliable way to serve javascript, always fast and always with correct version, with respect for the authors of the libraries! Richard: For the debugging purposes I do not use minified and consolidated javascript. I have a build process which compresses the js when I commit sources to svn. It consolidates and compress javascript. So, I code and test and debug plain readable files, then commit. Then I test the minified versions on pre-deploy enviroment, but at this point no debugging is required. I then deploy only the minified scripts. Regards, SWilk All good points. Excellent topic. The server side caching is really useful. I can show a drastic reduction in the bandwidth used for my CSS and JS files once I started doing that. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: $$ utility method returns href value instead of anchor tag reference
2009/3/21 T.J. Crowder t...@crowdersoftware.com: Hi, hmm, well, links[0] is returning a string, not the a object... No, it isn't. Richard already answered your question: Your alert coerces the object into a string, which implicitly calls the toString method on it, which (in the case of a link) returns the href. If you actually _try_ what he suggested, you'll see that he's right. Here's a page demonstrating this stuff: http://pastie.org/422726 If you run that in a browser, the output is: * * * * links.length = 4 typeof links[0] = object links[0].id = one links[0].href = http://prototypejs.org/api links[0].innerHTML = Prototype API links[0] dumped via implicit call to toString: http://prototypejs.org/api - The full array: Link one (Prototype API) links to http://prototypejs.org/api Link two (Google (U.S.)) links to http://www.google.com/ Link four (Example) links to http://example.com/ Link five (BBC News) links to http://news.bbc.co.uk/ * * * * HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Mar 20, 5:01 pm, tkane2000 tkthomp...@gmail.com wrote: hmm, well, links[0] is returning a string, not the a object, so those will both return null. The question is why does this statement: $$('.gallery .thumb .listItem .thumbHolder'); return the value of href (a string) and not that a object? Thanks! On Mar 20, 6:38 am, Richard Quadling rquadl...@googlemail.com wrote: Almost certainly you are seeing the results of a toString() method kicking in for the objects (or similar). Try ... alert(links[0]: + links[0].id + ':' + links[0].href); Richard Quadling. 2009/3/20 tkane2000 tkthomp...@gmail.com: How come the $$() function returns the value of the href when selecting an anchor tag instead of the tag itself? ...I've had mixed results for this btwn FF and IE6, but it's consistant in the code below. Anyone know what I'm doing wrong here or if there's a workaround? div id=gallery div class=thumb div class=listItem a href=/asdfasdf/asdfsdf.jhtml class=thumbHolderthis is some text/abr / a href=/asdfasdf/asdfsdf.jhtml class=thumbHolderthis is some text/abr / /div /divbr / div class=thumb div class=listItem a href=/asdfasdf/234234.jhtml class=thumbHolderthis is some text 21/abr / a href=/asdfasdf/234234.jhtml class=thumbHolderthis is some text 23/abr / /div /div /div script type=text/javascript var links = $$('.gallery .thumb .listItem .thumbHolder'); alert(links[0]: + links[0]); /script -- - Richard Quadling Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! Thanks TJ. Still learning. PHP is my bag. Prototype is very much being added to it though. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] a problem with event.stop in FF2
Does anyone know about a fix for this problem: Prototype.js event.stop (event) FF2 not working (http://www.ruby-forum.com/topic/146797) ? I have encountered this bug while migrating to Prototype 1.6.0.3 The error appeared in FF2. It works fine in IE6, and I am not sure about FF3 or Chrome. What I see in the code it that while in Prototype 1.5.1.1 the function looked like that: stop: function(event) { if (event.preventDefault) { event.preventDefault(); event.stopPropagation(); } else { event.returnValue = false; event.cancelBubble = true; } } in prototype 1.6.0.3 it looks like that: stop: function(event) { Event.extend(event); event.preventDefault(); event.stopPropagation(); event.stopped = true; } but there is also this code: if (Prototype.Browser.IE) { Object.extend(methods, { stopPropagation: function() { this.cancelBubble = true }, preventDefault: function() { this.returnValue = false }, inspect: function() { return [object Event] } }); which seems to add dummy function if we use IE. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Stopping submit event
At 06:41 -0700 23/3/09, T.J. Crowder wrote: function venFormhandler(event) { event.stop(); /* ...do your ajaxy goodness... */ } That's the one! I was trying to be too complicated. Thank you. -- Cheers... Chris Highway 57 Web Development -- http://highway57.co.uk/ A censor is a man who knows more than he thinks you ought to. -- Laurence J. Peter --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] scriptaculous dragdrop left percentage
Hi, Just noticed that if a draggable element uses a percentage in the style for 'left', a couple things don't seem to work right. !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http:// www.w3.org/TR/html4/loose.dtd html head script src=http://ussda.demosphere.com/common/js/ps1.8.2/ prototype.js language=JavaScript type=text/javascript/script script src=http://ussda.demosphere.com/common/js/ps1.8.2/ scriptaculous.js language=JavaScript type=text/javascript/ script /head body div id=d1 style=height:200px; width:300px; border:1px solid green; position:relative; div id=d2 style=position:absolute; top:20px; left:20px; height: 20px; width:80px; border:1px solid gray; ABC 123 /div /div script type=text/javascript new Draggable('d2',{revert:true}); /script /body /html Notice the 'left:20px' style - this setting works ok. But if you try it with 'left:20%' two odd things happen. The first is very quick in this example and hard to see (but shows up more in my production version) - at the start of the drag, there is a quick flash or wiggle to left=0 then back again. This does not happen with a 'px' setting only with a '%' setting. The second is the x,y location where it reverts to - it always goes back to the numeric quantity in pixel units, not the amount as a percentage. Wouldn't this be a bug? I like to use percentage because my container element changes in size if the browser window is resized or more options are chosen, etc. For now however, I'm doing something like this: var wid=$('container').getWidth(); var gleft=Math.round(wid*0.04); // left:4% gdiv.setStyle({position:'absolute', top:gtop+'px', left:gleft +'px', width:'92%'}); With that it doesn't flash, and stays lined up as the drag and drop operates, but of course it isn't reacting to dynamic changes in container size as it would with a percentage. Thanks, --Jay --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Element.insert failed on IE
Sorry, I forget to write de prototype version I use. This is the 1.6.0.3. My test is on IE 7. firstRow and response are good. I will continue to investigate the issue... On 23 mar, 11:47, T.J. Crowder t...@crowdersoftware.com wrote: Hi, Internet Explorer can be difficult about adding to tables using strings, but the current version of Prototype (1.6.0.3) has code to deal with it for you. Are you using 1.6.0.3? If I have a table with a row in it with the id rowbefore, this code works fine for me on IE7: $('rowbefore').insert({ before: 'trtdBlah/tdtdBlah/td/tr' }); (I can't test IE6 at the mo.) It works because Element#insert actually creates a temporary table for you, then grabs the rows and moves them into your target table. I don't know when that code made it into the codebase, but again it's there in 1.6.0.3. Alternately, are you absolutely sure that by the time you get to this line: firstRow.insert({before: response}) ...that A) 'firstRow ' really is a reference to a row in the table, and B) 'response' really is a string with a valid row in it? HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Mar 23, 10:12 am, djice jcjabouille...@gmail.com wrote: Hi, I use an Ajax request for posting my form. The response of this request is a string which contains HTML tr id=111td/ tdtd../td/tr. This html represents a row of a table, my goal is to add this row to my table. So I use this code: firstRow = $('msg'+colorIndicator); response = xhr.responseText; firstRow.insert({before: response}) $firstRow if the first row of my table. $responde is my ajax response tr id=111td/tdtd../td/tr. This code works on Firefox but not on IE. When I try this on IE, there is no javascript error message and the javascript code following is not executed. Nothing appends... What is the issue ? The fix ? Is it an official bug ? Maybe $response has to be a javascript object instead of a string ? Thanks for your help, djice --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Is it a bug about getDimensions ?
Hi, all, My use the prototype from http://www.prototypejs.org/assets/2008/9/29/prototype-1.6.0.3.js . I use the getDimensions function to get the size of the windows like this head meta http-equiv=content-type content=text/html; charset=utf-8 / titleGet The Width And Height Of The Browser/title /head script src=prototype-1.6.0.3.js/script !-- script src=prototype-1.6.0.3.alin.js/script -- script type=text/javascript function on_window_resize() { var size = document.viewport.getDimensions(); $(height).value = size.height; $(width).value = size.width; } /script body onresize=on_window_resize() onload=on_window_resize() Width:input type=text id=width /br / Height:input type=text id=height /br / /body but the result is wrong except IE. I try it in the Firefox, Opera and ... the browser, the result is wrong. I modify the getDimensions, and it can works in Firefox , safari and Opera now. But I don't know whether is a bug ? This is my patch ?? a...@alin-laptop:~/Documents$ cat /home/alin/Desktop/getDimensions/ getDimensions.patch 2694,2700c2694,2697 if (B.WebKit !document.evaluate) { // Safari 3.0 needs self.innerWidth/Height dimensions[d] = self['inner' + D]; } else if (B.Opera parseFloat(window.opera.version()) 9.5) { // Opera 9.5 needs document.body.clientWidth/Height dimensions[d] = document.body['client' + D] } else { --- /* Modify by Fang Yunlin, mail: cst05...@gmail.com, MSN: cst05...@hotmail.com */ /*===Begin*/ if (B.IE) { //IE 7.0(Windows) 2701a2699,2701 } else { //Firefox 3.0.7(Windows), Firefox 3.0.7(Linux), Opera 9.64(Windows), Opera 9.64(Linux), Safari 3.2.2(Windows), Chrome 2.0.166.1(Windows), Konqueror 4.2.00(Linux), Epiphany 2.24.1(Linux) dimensions[d] = self['inner' + D]; 2703c2703,2704 }); --- /*===End=*/ }); 4320c4321 Element.addMethods(); \ No newline at end of file --- Element.addMethods(); This is the function after I modify: document.viewport = { getDimensions: function() { var dimensions = { }, B = Prototype.Browser; $w('width height').each(function(d) { var D = d.capitalize(); /* Modify by Fang Yunlin, mail: cst05...@gmail.com, MSN: cst05...@hotmail.com */ /*===Begin*/ if (B.IE) { //IE 7.0(Windows) dimensions[d] = document.documentElement['client' + D]; } else { //Firefox 3.0.7(Windows), Firefox 3.0.7(Linux), Opera 9.64 (Windows), Opera 9.64(Linux), Safari 3.2.2(Windows), Chrome 2.0.166.1 (Windows), Konqueror 4.2.00(Linux), Epiphany 2.24.1(Linux) dimensions[d] = self['inner' + D]; } /*===End=*/ }); return dimensions; }, 2685,20 62% Thank You ! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Is it a bug about getDimensions ?
yes there is a bug somewhere ... i was doing something the other day that required it.. and my work around was var dims=$(document.body).getDimensions(); this seemed to work well with all browsers i tested on (ie7,8,FF3,FF2,Safari -Win,Opera9) HTH Alex - Original Message - From: Fang Yunlin cst05...@gmail.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Monday, March 23, 2009 4:53 PM Subject: [Proto-Scripty] Is it a bug about getDimensions ? Hi, all, My use the prototype from http://www.prototypejs.org/assets/2008/9/29/prototype-1.6.0.3.js . I use the getDimensions function to get the size of the windows like this head meta http-equiv=content-type content=text/html; charset=utf-8 / titleGet The Width And Height Of The Browser/title /head script src=prototype-1.6.0.3.js/script !-- script src=prototype-1.6.0.3.alin.js/script -- script type=text/javascript function on_window_resize() { var size = document.viewport.getDimensions(); $(height).value = size.height; $(width).value = size.width; } /script body onresize=on_window_resize() onload=on_window_resize() Width:input type=text id=width /br / Height:input type=text id=height /br / /body but the result is wrong except IE. I try it in the Firefox, Opera and ... the browser, the result is wrong. I modify the getDimensions, and it can works in Firefox , safari and Opera now. But I don't know whether is a bug ? This is my patch ?? a...@alin-laptop:~/Documents$ cat /home/alin/Desktop/getDimensions/ getDimensions.patch 2694,2700c2694,2697 if (B.WebKit !document.evaluate) { // Safari 3.0 needs self.innerWidth/Height dimensions[d] = self['inner' + D]; } else if (B.Opera parseFloat(window.opera.version()) 9.5) { // Opera 9.5 needs document.body.clientWidth/Height dimensions[d] = document.body['client' + D] } else { --- /* Modify by Fang Yunlin, mail: cst05...@gmail.com, MSN: cst05...@hotmail.com */ /*===Begin*/ if (B.IE) { //IE 7.0(Windows) 2701a2699,2701 } else { //Firefox 3.0.7(Windows), Firefox 3.0.7(Linux), Opera 9.64(Windows), Opera 9.64(Linux), Safari 3.2.2(Windows), Chrome 2.0.166.1(Windows), Konqueror 4.2.00(Linux), Epiphany 2.24.1(Linux) dimensions[d] = self['inner' + D]; 2703c2703,2704 }); --- /*===End=*/ }); 4320c4321 Element.addMethods(); \ No newline at end of file --- Element.addMethods(); This is the function after I modify: document.viewport = { getDimensions: function() { var dimensions = { }, B = Prototype.Browser; $w('width height').each(function(d) { var D = d.capitalize(); /* Modify by Fang Yunlin, mail: cst05...@gmail.com, MSN: cst05...@hotmail.com */ /*===Begin*/ if (B.IE) { //IE 7.0(Windows) dimensions[d] = document.documentElement['client' + D]; } else { //Firefox 3.0.7(Windows), Firefox 3.0.7(Linux), Opera 9.64 (Windows), Opera 9.64(Linux), Safari 3.2.2(Windows), Chrome 2.0.166.1 (Windows), Konqueror 4.2.00(Linux), Epiphany 2.24.1(Linux) dimensions[d] = self['inner' + D]; } /*===End=*/ }); return dimensions; }, 2685,20 62% Thank You ! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: $$ utility method returns href value instead of anchor tag reference
thanks guys, that makes sense. I hacked around w/ it and found that the issue I'm running into was based on 2 things: 1. I'm selecting gallery as a class instead of an id (syntax error) 2. I'm running into an issue w/ IE in which I can't overwrite the onClick attribute. #2 isn't shown in this example. ...long story as to why I need to do this and I'm not sure it's possible really. ...will start a new thread. Thanks Again! On Mar 23, 7:51 am, Richard Quadling rquadl...@googlemail.com wrote: 2009/3/21 T.J. Crowder t...@crowdersoftware.com: Hi, hmm, well, links[0] is returning a string, not the a object... No, it isn't. Richard already answered your question: Your alert coerces the object into a string, which implicitly calls the toString methodon it, which (in the case of a link)returnsthehref. If you actually _try_ what he suggested, you'll see that he's right. Here's a page demonstrating this stuff: http://pastie.org/422726 If you run that in a browser, the output is: * * * * links.length = 4 typeof links[0] = object links[0].id = one links[0].href=http://prototypejs.org/api links[0].innerHTML = Prototype API links[0] dumped via implicit call to toString:http://prototypejs.org/api - The full array: Link one (Prototype API) links tohttp://prototypejs.org/api Link two (Google (U.S.)) links tohttp://www.google.com/ Link four (Example) links tohttp://example.com/ Link five (BBC News) links tohttp://news.bbc.co.uk/ * * * * HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Mar 20, 5:01 pm, tkane2000 tkthomp...@gmail.com wrote: hmm, well, links[0] is returning a string, not the a object, so those will both return null. The question is why does this statement: $$('.gallery .thumb .listItem .thumbHolder'); return thevalueofhref(a string) and not that a object? Thanks! On Mar 20, 6:38 am, Richard Quadling rquadl...@googlemail.com wrote: Almost certainly you are seeing the results of a toString()method kicking in for the objects (or similar). Try ... alert(links[0]: + links[0].id + ':' + links[0].href); Richard Quadling. 2009/3/20 tkane2000 tkthomp...@gmail.com: How come the $$() functionreturnsthevalueof thehrefwhen selecting ananchortaginsteadof thetagitself? ...I've had mixed results for this btwn FF and IE6, but it's consistant in the code below. Anyone know what I'm doing wrong here or if there's a workaround? div id=gallery div class=thumb div class=listItem ahref=/asdfasdf/asdfsdf.jhtml class=thumbHolderthis is some text/abr / ahref=/asdfasdf/asdfsdf.jhtml class=thumbHolderthis is some text/abr / /div /divbr / div class=thumb div class=listItem ahref=/asdfasdf/234234.jhtml class=thumbHolderthis is some text 21/abr / ahref=/asdfasdf/234234.jhtml class=thumbHolderthis is some text 23/abr / /div /div /div script type=text/javascript var links = $$('.gallery .thumb .listItem .thumbHolder'); alert(links[0]: + links[0]); /script -- - Richard Quadling Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! Thanks TJ. Still learning. PHP is my bag. Prototype is very much being added to it though. -- - Richard Quadling Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731 Standing on the shoulders of some very clever giants! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Proto-Scripty] Overwrite onClick in IE
...long story as to why I need to do this, but I have a set of links that already have onClick event handlers set and I need to overwrite them. If I could just get them to return false and do nothing else, I could use the observe method to the the rest. Below is an example of what I mean: The following script works in FF3, but not IE7: div id=gallery div class=thumb div class=listItem a href=http://www.cnn.com; onClick=location.href='http://www.google.com' class=thumbHolderthis is some text/abr / /div /div /div script type=text/javascript var links = $$('#gallery .thumb .listItem .thumbHolder'); links[0].writeAttribute({onClick:alert('test');return false;}); // works in FF, but not IE /script Any idea why this works in FF but not IE? Any hacks to get around it? (keep in mind I can't edit the anchor tag directly...must do it through js) Thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---