From trojani2000 at hotmail.com Tue Jul 8 21:14:17 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Wed, 9 Jul 2008 02:14:17 +0000 Subject: [Javascript] SAFARI javascript css problem In-Reply-To: <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> Message-ID: Hello @all I'm having an unexpected problem with my script in Safari. It works great with IE and Firefox, it works (sometimes) in Opera, but that's in relation to Op UI, but completely fails in Safari. The script uses css selectors to read some css rule. A call to stylesheets collection loop in through defined selectors matching the selector, and reading its required property. But Safari doesn't! I was allways very good at debuging scripts, but this is something new. I found that it understands the call: "document.styleSheets" but it doesn't seem to be the correct answer: "document.styleSheets" because the result is "0" and it should be at least 1 or higher. Does this mean that it is not able to return styles? And does anybody happen to know why? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _________________________________________________________________ Need to know now? Get instant answers with Windows Live Messenger. http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_messenger_072008 From trojani2000 at hotmail.com Wed Jul 9 22:17:27 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Thu, 10 Jul 2008 03:17:27 +0000 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> Message-ID: Hello once again Are there guys supporting Safari at all in this list? I've just tried the error alert the old way function tellerror(msg, url, linenumber){alert('Error message= '+msg+'\nURL= '+url+'\nLine Number= '+linenumber)return true}window.onerror=tellerror Nothing! Plain def... FX, IE majors are delivering alertbox with exact error line number etc (!?Opera is silent also). Does anybody know what's going on here? Are they trying to impose on us some new "standard" standards again and break once again everything achieved this far? ? ? ?~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > From: trojani2000 at hotmail.com> To: javascript at lists.evolt.org> Date: Wed, 9 Jul 2008 02:14:17 +0000> Subject: [Javascript] SAFARI javascript css problem> > Hello @all> I'm having an unexpected problem with my script in Safari.> It works great with IE and Firefox, it works (sometimes)> in Opera, but that's in relation to Op UI, but completely fails> in Safari. > > The script uses css selectors to read some css rule.> A call to stylesheets collection > loop in through defined selectors> matching the selector,> and reading its required property.> > But Safari doesn't! > > I was allways very good at debuging scripts, but this is something new.> I found that it understands the call: "document.styleSheets"> but it doesn't seem to be the correct answer: > "document.styleSheets" because the result is "0" and it should be at least> 1 or higher.> > Does this mean that it is not able to return styles? And does anybody > happen to know why?> > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> _________________________________________________________________> Need to know now? Get instant answers with Windows Live Messenger.> http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_messenger_072008> _______________________________________________> Javascript mailing list> Javascript at lists.evolt.org> http://lists.evolt.org/mailman/listinfo/javascript _________________________________________________________________ Need to know now? Get instant answers with Windows Live Messenger. http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_messenger_072008 From ovsnk-reachme at yahoo.com Thu Jul 10 00:58:19 2008 From: ovsnk-reachme at yahoo.com (Nagendra Oleti) Date: Wed, 9 Jul 2008 22:58:19 -0700 (PDT) Subject: [Javascript] how to get all onload functions Message-ID: <578057.79153.qm@web31104.mail.mud.yahoo.com> I want to know all the functions that are being executed as part of the onload event.?Is there a way to know this? thanks -nagendra From trojani2000 at hotmail.com Thu Jul 10 02:32:56 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Thu, 10 Jul 2008 07:32:56 +0000 Subject: [Javascript] how to get all onload functions In-Reply-To: <578057.79153.qm@web31104.mail.mud.yahoo.com> References: <578057.79153.qm@web31104.mail.mud.yahoo.com> Message-ID: nagendra, try: alert(window.onload); (put this at the end of the last script entry and reload the page)The fuction attached to onload will be drawn on your alert box; That is, the main function that will invoke all others after onload event has fired. You will be able to read which functions are being called by this initializer. But there are other functions that are written to get executed as the page loads so you'll be forced to jump into that code and see where they are. I often write and invoke functions like this: function myfunction(){ alert("This function ran on debugg time")} myfunction(); //or maybe: document.runMy2ndAlert= function(){alert("This anonymous function ran when assigned to 'myVar'"); return "Sorry, - I allready fired my alert message!"} var myVar=document.runMy2ndAlert() //now we'll alert the returned value of this function alert(myVar) //etc... regards.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Date: Wed, 9 Jul 2008 22:58:19 -0700> From: ovsnk-reachme at yahoo.com> To: javascript at lists.evolt.org> Subject: [Javascript] how to get all onload functions> > I want to know all the functions that are being executed as part of the onload event. Is there a way to know this? thanks> -nagendra> _______________________________________________> Javascript mailing list> Javascript at lists.evolt.org> http://lists.evolt.org/mailman/listinfo/javascript _________________________________________________________________ Use video conversation to talk face-to-face with Windows Live Messenger. http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_video_072008 From gregorinator at gmail.com Thu Jul 10 06:40:18 2008 From: gregorinator at gmail.com (gregorinator) Date: Thu, 10 Jul 2008 07:40:18 -0400 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> Message-ID: <2bd1359c0807100440y1d6207e0q793c5a5696dfdc53@mail.gmail.com> On Wed, Jul 9, 2008 at 11:17 PM, Troy III Ajnej wrote: > function tellerror(msg, url, linenumber){alert('Error message= '+msg+'\nURL= '+url+'\nLine Number= > '+linenumber)return true}window.onerror=tellerror This is just a complete shot in the dark (I don't have Safari to try it), but I'd start by terminating each of the commands with semicolons: function tellerror(msg, url, linenumber){alert('Error message= '+msg+'\nURL= '+url+'\nLine Number= '+linenumber;)return true;}window.onerror=tellerror; gs From kamaleshwar.morjal at gmail.com Thu Jul 10 11:36:02 2008 From: kamaleshwar.morjal at gmail.com (Kamaleshwar Morjal) Date: Thu, 10 Jul 2008 17:36:02 +0100 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: <2bd1359c0807100440y1d6207e0q793c5a5696dfdc53@mail.gmail.com> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <2bd1359c0807100440y1d6207e0q793c5a5696dfdc53@mail.gmail.com> Message-ID: <48763A72.9060605@gmail.com> gregorinator wrote: > On Wed, Jul 9, 2008 at 11:17 PM, Troy III Ajnej wrote: > >> function tellerror(msg, url, linenumber){alert('Error message= '+msg+'\nURL= '+url+'\nLine Number= >> '+linenumber)return true}window.onerror=tellerror >> > > This is just a complete shot in the dark (I don't have Safari to try > it), but I'd start by terminating each of the commands with > semicolons: > > function tellerror(msg, url, linenumber){alert('Error message= > '+msg+'\nURL= '+url+'\nLine Number= '+linenumber;)return > err.. shouldn't this ^^^ be .... +linenumber); return true; ? From gregorinator at gmail.com Thu Jul 10 07:15:46 2008 From: gregorinator at gmail.com (gregorinator) Date: Thu, 10 Jul 2008 08:15:46 -0400 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: <48763A72.9060605@gmail.com> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <2bd1359c0807100440y1d6207e0q793c5a5696dfdc53@mail.gmail.com> <48763A72.9060605@gmail.com> Message-ID: <2bd1359c0807100515q17fdea36qe13c9d35dd066410@mail.gmail.com> On Thu, Jul 10, 2008 at 12:36 PM, Kamaleshwar Morjal wrote: > err.. shouldn't this ^^^ be > > .... +linenumber); return true; To that I can only say... "return true;"! Thanks for catching that. :) gs From trojani2000 at hotmail.com Thu Jul 10 16:09:31 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Thu, 10 Jul 2008 21:09:31 +0000 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: <2bd1359c0807100440y1d6207e0q793c5a5696dfdc53@mail.gmail.com> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <2bd1359c0807100440y1d6207e0q793c5a5696dfdc53@mail.gmail.com> Message-ID: > This is just a complete shot in the dark ... Yeah, whenever I do that I end up with a dead Elefant on myhands! It is not that wize to shot in the dark in Safari. :) That code is not only "classic" it's allso a bulletprof code, & it's not mine. I took it from references. I have to point out another fact that mail parser is doing something wrong with my content and removing newlilne codes from it very inconsistently. So that function and some other lines got merged into one. The code in disscussion works in IE javascript 1.3; it works in FX js 1.5; in Opera js 2.0; -but not in Safari js 1.5! I'm begining to think that there is something else in stake, Safari will drop every other correct code contents as soon as one single error is encountered, but this is another shot in the dark I guess. :D Thank you. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Date: Thu, 10 Jul 2008 07:40:18 -0400> From: gregorinator at gmail.com> To: javascript at lists.evolt.org> Subject: Re: [Javascript] SAFARI javascript major problem> > On Wed, Jul 9, 2008 at 11:17 PM, Troy III Ajnej wrote:> > function tellerror(msg, url, linenumber){alert('Error message= '+msg+'\nURL= '+url+'\nLine Number=> > '+linenumber)return true}window.onerror=tellerror> > This is just a complete shot in the dark (I don't have Safari to try> it), but I'd start by terminating each of the commands with> semicolons:> > function tellerror(msg, url, linenumber){alert('Error message=> '+msg+'\nURL= '+url+'\nLine Number= '+linenumber;)return> true;}window.onerror=tellerror;> > gs> _______________________________________________> Javascript mailing list> Javascript at lists.evolt.org> http://lists.evolt.org/mailman/listinfo/javascript _________________________________________________________________ Need to know now? Get instant answers with Windows Live Messenger. http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_messenger_072008 From pp.koch at gmail.com Thu Jul 10 17:28:09 2008 From: pp.koch at gmail.com (Peter-Paul Koch) Date: Fri, 11 Jul 2008 00:28:09 +0200 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> Message-ID: <21e4a1280807101528v4adf409fje7d2bfb125404243@mail.gmail.com> > I've just tried the error alert the old way > function tellerror(msg, url, linenumber){alert('Error message= '+msg+'\nURL= '+url+'\nLine Number= '+linenumber)return true}window.onerror=tellerror Safari does not support window.onerror. (Neither does Opera, BTW). http://www.quirksmode.org/dom/events/error.html > Nothing! Plain def... > FX, IE majors are delivering alertbox with exact error line number etc > (!?Opera is silent also). > Does anybody know what's going on here? > Are they trying to impose on us some new "standard" standards again > and break once again everything achieved this far? -- ------------------------------------------------------------------- ppk, freelance web developer http://www.quirksmode.org/ ------------------------------------------------------------------ From mdougherty at pbp.com Thu Jul 10 20:08:37 2008 From: mdougherty at pbp.com (Mike Dougherty) Date: Thu, 10 Jul 2008 21:08:37 -0400 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: <21e4a1280807101528v4adf409fje7d2bfb125404243@mail.gmail.com> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <21e4a1280807101528v4adf409fje7d2bfb125404243@mail.gmail.com> Message-ID: <59bedf280807101808p7c27b2dfv318b81f3ba99b106@mail.gmail.com> On Thu, Jul 10, 2008 at 6:28 PM, Peter-Paul Koch wrote: > Safari does not support window.onerror. (Neither does Opera, BTW). > > http://www.quirksmode.org/dom/events/error.html I didn't know there was such a method. I usually wrap code in try..catch if I am unsure what might go wrong. (I also usually try to anticipate and prevent those runtime errors I can predict, so the catch() block is really only a safety net for the unexpected and non-standard.) From trojani2000 at hotmail.com Fri Jul 11 08:08:33 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Fri, 11 Jul 2008 13:08:33 +0000 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: <21e4a1280807101528v4adf409fje7d2bfb125404243@mail.gmail.com> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <21e4a1280807101528v4adf409fje7d2bfb125404243@mail.gmail.com> Message-ID: > Safari does not support window.onerror. (Neither does Opera, BTW). That's pretty modern I'd say.They're calling themselves -"Modern Browsers". I wonder though: -What is so "modern" about deliberately devolving Internet and delivering almost mutilated applications to the clients? But let me first salute you. It has been a long time. It's an honor to read from you once again in Latech, or (is it) ListEvolt now. My original problem, however, was not alerting JavaScript errors. It was in relation to "stylesheets collection" and manipulation, where Safari doesn't seem to follow, I can't figure out. While trying to deal with it - just prior to posting this letter - I encountered another problem. That is: Any error on a script body will cause a failure to all the rest. It's as if the "script element" is being treated as a single function. Its interesting thing to mention that Safari is, ( who knows why ) secretly supporting IE syntax "document.styleSheets[index].rules", but it's insignificant because it doesn't follow in other aspects. I will try to post some testing code that might help drawing some conclusions about these Safari problems. (It will take some time to clean/write and organize, but I'll be back soon) Until than, my best regards to all. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Date: Fri, 11 Jul 2008 00:28:09 +0200> From: pp.koch at gmail.com> To: javascript at lists.evolt.org> Subject: Re: [Javascript] SAFARI javascript major problem> > > I've just tried the error alert the old way> > function tellerror(msg, url, linenumber){alert('Error message= '+msg+'\nURL= '+url+'\nLine Number= '+linenumber)return true}window.onerror=tellerror> > Safari does not support window.onerror. (Neither does Opera, BTW).> > http://www.quirksmode.org/dom/events/error.html> > > Nothing! Plain def...> > FX, IE majors are delivering alertbox with exact error line number etc> > (!?Opera is silent also).> > Does anybody know what's going on here?> > Are they trying to impose on us some new "standard" standards again> > and break once again everything achieved this far?> > -- > -------------------------------------------------------------------> ppk, freelance web developer> http://www.quirksmode.org/> ------------------------------------------------------------------> _______________________________________________> Javascript mailing list> Javascript at lists.evolt.org> http://lists.evolt.org/mailman/listinfo/javascript _________________________________________________________________ The i?m Talkaton. Can 30-days of conversation change the world? http://www.imtalkathon.com/?source=EML_WLH_Talkathon_ChangeWorld From trojani2000 at hotmail.com Sat Jul 12 11:54:33 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Sat, 12 Jul 2008 16:54:33 +0000 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <21e4a1280807101528v4adf409fje7d2bfb125404243@mail.gmail.com> Message-ID: I'm suspicious? Did this post ever made it to our List? (I allways recieve confirmation. -This once i didn't!). I've promissed that I'll post it soon after my last relation. Here it is once again; //these are some of my tests regarding the problem I haven't solved yet. The scripts are ready for testing if anybody interested. p.s.: I still need to store a stylesheet collection in a global var and be able to use it from my other functions in safari... Regards. ...................................................................... From: trojani2000 at hotmail.com To: trojani2000 at hotmail.com Subject: RE: [Javascript] SAFARI javascript major problem Date: Fri, 11 Jul 2008 15:21:26 +0000 I guess that my last shot in the dark was correct. Safari is ?forgetting the length of stylesheets collection assigned to a global variable. I'm adding this block of script here to isolate the code that will cause Safari to stop executing the rest of it. I hope mail handler will not delete newline characters and mess the code up as in my previous post. script type="text/javascript"> var dS = document.styleSheets, theRules; //Preparing globals for IE's "rule" call separately// function prepareVar(){ if(dS) theRules = dS[0].rules || dS[0].cssRules; } prepareVar(); /script> script type="text/javascript" language="JavaScript1.0"> /* I've declared javacript language v1.0 "to make sure" that the * browser is not interpreting this js code in some unknown * ?modern manner, but who knows if browsers will take this in * account? Removing it will have no impact at all */ /* //I need these global vars: var dS = document.styleSheets; var theRules = dS[0].rules || dS[0].cssRules; //I'm depending on a function that depends on "theRules" collection: function rulesLength(){ if(theRules) alert(theRules.length); } */ // Now, if I write the same function this way var dS = document.styleSheets, theRules; function rulesLength(){ if(dS) var theRules = dS[0].rules || dS[0].cssRules; if(theRules) alert("Rules: "+theRules.length +" Troy [event: \"onclick\"]"); } document.onclick=rulesLength // Safari will join the group and report the length of css rules as seen by most. //Now I'm modifying your (PPK's) published function to only report the length. function changeIt() { if (!document.styleSheets) return; var theRules = new Array(); if (document.styleSheets[0].cssRules) theRules = document.styleSheets[0].cssRules else if (document.styleSheets[0].rules) theRules = document.styleSheets[0].rules else return; alert("Rules: "+theRules.length +" PPK [event: \"onload\"]") } window.onload=changeIt //Works perfectly including SAFARI. /* -------------------------------------------------------------------- * So where is the problem? The problem(s) are, that if you remove the * multiline script comments from the first version function, -the rest * of functions will all fail miserably. Including your (PPK) very firm and * elegant full step conditional procedure. * ---------------------------------------------*/ // -Now let's try this: if(dS){alert("1. Stylesheets Length: "+dS.length)} //Safari is returnig 0. This is definitely what is causing the error. // How about this: function getStylesLength(){ if(dS) //I'm numbering the separate alerts by order they should appear. alert("2.0 "+dS); alert("2.1 "+dS+" Length: "+dS.length); alert("2.2 "+theRules); alert("2.3 "+theRules+ " Length: "+ theRules.length) } getStylesLength() /* There we have another zero length stylesheets object. * "dS" is a global var and its assigned value, should outlive at least * the debug time of the page load, but in SAFARI, if not used immediately * it 'dies' as soon as the second declaration is parsed. */ /* My final wondering concerns this nebulosity: Is it a SAFARI bug or something else? Because dS variable is returning "[Object StyleSheetList]" as registered object. If it really is a style sheet object list than it should have a length of stylesheets currently available. (in my testing I have two, one embedded, the other is linked) but SAFARI reports 0 [null], that's WRONG! */ //OK let's give it my last try (your procedure): function lastTrial(){ var cssRlen = new Array(); if (document.styleSheets[0].cssRules) cssRlen = document.styleSheets[0].cssRules else if(document.styleSheets[0].rules) cssRlen = document.styleSheets[0].rules alert("last entry trial:" +cssRlen.length) } lastTrial() //At this point It fails too! /* Well, my final thought on this issue is that SAFARI has a serious bug.*/ /script> Anybody any ideas? I need a cssrules collection stored in a global var supported by Safari Is it possible? Many thanks in advance p.s.: what I've learned so far when coding for safari: "it is wise to isolate every function in a separate script element. Long functions, whenever possible to split in smaller.:) That's the beauty of "modern". :D ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _________________________________________________________________ Need to know now? Get instant answers with Windows Live Messenger. http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_messenger_072008 From trojani2000 at hotmail.com Sun Jul 13 07:55:58 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Sun, 13 Jul 2008 12:55:58 +0000 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: <59bedf280807101808p7c27b2dfv318b81f3ba99b106@mail.gmail.com> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <21e4a1280807101528v4adf409fje7d2bfb125404243@mail.gmail.com> <59bedf280807101808p7c27b2dfv318b81f3ba99b106@mail.gmail.com> Message-ID: What method were you referring to when you said that? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Date: Thu, 10 Jul 2008 21:08:37 -0400> From: mdougherty at pbp.com> To: javascript at lists.evolt.org> Subject: Re: [Javascript] SAFARI javascript major problem> >> I didn't know there was such a method... >> _______________________________________________> Javascript mailing list> Javascript at lists.evolt.org> http://lists.evolt.org/mailman/listinfo/javascript _________________________________________________________________ Making the world a better place one message at a time. http://www.imtalkathon.com/?source=EML_WLH_Talkathon_BetterPlace From rer at datacompusa.com Mon Jul 14 06:58:15 2008 From: rer at datacompusa.com (Roger Roelofs) Date: Mon, 14 Jul 2008 07:58:15 -0400 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> Message-ID: <23CC9276-0C86-4B51-B03B-443E33F5226D@datacompusa.com> Troy, On Jul 9, 2008, at 11:17 PM, Troy III Ajnej wrote: > Are there guys supporting Safari at all in this list? Yes, but early versions were incomplete at best. Which version are you testing? >> I'm having an unexpected problem with my script in Safari. >> > > The script uses css selectors to read some css rule.> A call to >> stylesheets collection > loop in through defined selectors> >> matching the selector,> and reading its required property. I just re-tested the current version (3.1.1) and this statement, typed into the location bar, worked as expected javascript:alert(document.styleSheets[0].rules[0].selectorText); Roger -- Roger Roelofs Datacomp Appraisal Services 3215 Eaglecrest, NE Grand Rapids, MI 49525 From trojani2000 at hotmail.com Tue Jul 15 03:30:52 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Tue, 15 Jul 2008 08:30:52 +0000 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: <23CC9276-0C86-4B51-B03B-443E33F5226D@datacompusa.com> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <23CC9276-0C86-4B51-B03B-443E33F5226D@datacompusa.com> Message-ID: Hello Roger, nice to hear from you. I'm currently on the latest Safari 3.1.2 (525.21) I am at knowledge that: javascript:alert(document.styleSheets[0].rules[0].selectorText); will work, -on address-bar especially, but I'm not be able to code onclients address bar from here. :) The: alert(document.styleSheets[0].rules[0].selectorText); will not work inside the script body. -Of course it will work, if, and only if there are no external stylesheets presently linked to the document, but that's pointless & useless equally. Cause I'm not willing to include them all back in the header of every page right now! -Well, would you? Ironically, javascript:alert(document.styleSheets[0].rules[0].selectorText); will continue to work (on address bar) even if external SS are present. There is another [? "%#@$" ] that might fool the coder to conclude thathis script somehow is beginning to work. If command: javascript:alert(document.styleSheets[0].rules[0].selectorText); is present in Safari address bar, each Refresh will trigger its executionproviding you with correct output in your alert box that will make you think that existing code in your document, exmp.: ...is working. But, for this matter, the previous, will not work in FX2 or Opera either! It will throw: "document.styleSheets[0].rules has no properties",since it has to do with syntax "rules" vs. W3C "cssRules" error. So,correcting this, will make it work as expected in Fx & Op, but not in Sf! Try: But as I already noted, if linked external style sheets are present, it will not work in Safari. My conclusion is that this must be an obvious Safari bug. Best Regards ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > From: rer at datacompusa.com> To: javascript at lists.evolt.org> Date: Mon, 14 Jul 2008 07:58:15 -0400> Subject: Re: [Javascript] SAFARI javascript major problem> > Troy,> > On Jul 9, 2008, at 11:17 PM, Troy III Ajnej wrote:> > > Are there guys supporting Safari at all in this list?> Yes, but early versions were incomplete at best. Which version are > you testing?> > >> I'm having an unexpected problem with my script in Safari.> >> > > The script uses css selectors to read some css rule.> A call to > >> stylesheets collection > loop in through defined selectors> > >> matching the selector,> and reading its required property.> > I just re-tested the current version (3.1.1) and this statement, typed > into the location bar, worked as expected> > javascript:alert(document.styleSheets[0].rules[0].selectorText);> > > Roger> --> Roger Roelofs> Datacomp Appraisal Services> 3215 Eaglecrest, NE> Grand Rapids, MI 49525> > _______________________________________________> Javascript mailing list> Javascript at lists.evolt.org> http://lists.evolt.org/mailman/listinfo/javascript _________________________________________________________________ The i?m Talkaton. Can 30-days of conversation change the world? http://www.imtalkathon.com/?source=EML_WLH_Talkathon_ChangeWorld From trojani2000 at hotmail.com Tue Jul 15 03:55:41 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Tue, 15 Jul 2008 08:55:41 +0000 Subject: [Javascript] FW: SAFARI javascript major problem In-Reply-To: References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <23CC9276-0C86-4B51-B03B-443E33F5226D@datacompusa.com> Message-ID: (Trying to clear the mess caused by missing new line characters in my previous post.) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From: trojani2000 at hotmail.comTo: trojani2000 at hotmail.comSubject: RE: [Javascript] SAFARI javascript major problemDate: Tue, 15 Jul 2008 08:26:46 +0000 Hello Roger, nice to hear from you.I'm currently on the latest Safari 3.1.2 (525.21)I am at knowledge that: javascript:alert(document.styleSheets[0].rules[0].selectorText);will work, -on address-bar especially, but I will not be able to code onclients address bar from here. :)The: alert(document.styleSheets[0].rules[0].selectorText);will not work inside the script body.-Of course it will work, if, and only if there are no external style-sheets presently linked to the document, but that's pointless & useless equally.Cause I'm not willing to include them all back in the header of every page right now!-Well, would you?Ironically, javascript:alert(document.styleSheets[0].rules[0].selectorText);will continue to work (on address bar) even if external SS are present.There is another [? "%#@$" ] that might fool the coder to conclude thathis script somehow is beginning to work.If command: javascript:alert(document.styleSheets[0].rules[0].selectorText);is present in Safari address bar, each Refresh will trigger its executionproviding you with correct output in your alert box that will make you think that existing code in your document, exmp.:...is working.But, for this matter, the previous, will not work in FX2 or Opera either! It will throw:"document.styleSheets[0].rules has no properties",since it has to do with syntax "rules" vs. W3C "cssRules" error. So,correcting this, will make it work as expected in Fx & Op, but not in Sf!Try:But as I already noted, if linked external style sheets are present, it will not work in Safari.My conclusion is that this must be an obvious Safari bug.Best Regards~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > From: rer at datacompusa.com> To: javascript at lists.evolt.org> Date: Mon, 14 Jul 2008 07:58:15 -0400> Subject: Re: [Javascript] SAFARI javascript major problem> > Troy,> > On Jul 9, 2008, at 11:17 PM, Troy III Ajnej wrote:> > > Are there guys supporting Safari at all in this list?> Yes, but early versions were incomplete at best. Which version are > you testing?> > >> I'm having an unexpected problem with my script in Safari.> >> > > The script uses css selectors to read some css rule.> A call to > >> stylesheets collection > loop in through defined selectors> > >> matching the selector,> and reading its required property.> > I just re-tested the current version (3.1.1) and this statement, typed > into the location bar, worked as expected> > javascript:alert(document.styleSheets[0].rules[0].selectorText);> > > Roger> --> Roger Roelofs> Datacomp Appraisal Services> 3215 Eaglecrest, NE> Grand Rapids, MI 49525> > _______________________________________________> Javascript mailing list> Javascript at lists.evolt.org> http://lists.evolt.org/mailman/listinfo/javascript Use video conversation to talk face-to-face with Windows Live Messenger. Get started. _________________________________________________________________ Need to know now? Get instant answers with Windows Live Messenger. http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_messenger_072008 From rer at datacompusa.com Wed Jul 16 07:52:53 2008 From: rer at datacompusa.com (Roger Roelofs) Date: Wed, 16 Jul 2008 08:52:53 -0400 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <23CC9276-0C86-4B51-B03B-443E33F5226D@datacompusa.com> Message-ID: <0A023390-65B7-45C5-9D7C-59855A8666D9@datacompusa.com> Troy, On Jul 15, 2008, at 4:30 AM, Troy III Ajnej wrote: > The: > alert(document.styleSheets[0].rules[0].selectorText); > will not work inside the script body. > -Of course it will work, if, and only if there are no external > stylesheets > presently linked to the document, but that's pointless & useless > equally. Sorry I took so long to get back to you. I just got back from vacation and I am still wading through the backlog. Thanks for bringing up this question. It has been educational for me. if you link your stylesheet like so: then alert(document.styleSheets[0].rules[0].selectorText will work just fine in Safari. The properties for document.styleSheets[0].rules[0] are selectorText: body style: [object CSSStyleDeclaration] parentStyleSheet: [object CSSStyleSheet] cssText: body { } type: 1 parentRule: null However, if you _import_ your stylesheet like so: the structure of the css is different and your first rule is an import rule which doesn't have selectorText. If you display the properties of document.styleSheets[0].rules[0] you get href: test.css styleSheet: [object CSSStyleSheet] media: [object MediaList] parentStyleSheet: [object CSSStyleSheet] cssText: @import url("test.css") ; type: 3 parentRule: null My guess is that ie and firefox are replacing the import rule with the contents of the imported file, while Safari is creating a hierarchy that matches the way you have specified your stylesheet in the DOM. You can get what you want in Safari by following the styleSheet object like so document.styleSheets[0].rules[0].styleSheet.rules[0].selectorText or you can change the html to only use linked stylesheets. Sorry i don't have better news, but at least we now understand how Safari works in this case. Roger -- Roger Roelofs Datacomp Appraisal Services 3215 Eaglecrest, NE Grand Rapids, MI 49525 From trojani2000 at hotmail.com Wed Jul 16 10:32:17 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Wed, 16 Jul 2008 15:32:17 +0000 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: <0A023390-65B7-45C5-9D7C-59855A8666D9@datacompusa.com> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <23CC9276-0C86-4B51-B03B-443E33F5226D@datacompusa.com> <0A023390-65B7-45C5-9D7C-59855A8666D9@datacompusa.com> Message-ID: Greetings Roger. I think, there is some misconception based on presumption. I am using "link" to link to my styles, because according tomy recent testing's, "import(s)" will make this fail on other agents too. Let alone that Safari has introduced another bug implying to execute the content on its location bar on each "refresh"... [!off topic, but,]This new bug will cause an undesired effect on client which accidentally changed some letter on current location, and if he/she, for any reason needs to refresh the current page, it willtry to navigate to a new (wrong) location, supplying him witha blank Safari page containing: "Safari can?t find the file." message. But this is a minor bug and out of our discussion context. Now let me proceed where I was left. To cut comments and explanations short, I will provide you withmy test page, so you can draw your conclusions from there. The complete demo code is here (except for the contents of the referred style sheet that you will need to link to). Safari Bug Not working on Safari! Regards. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > From: rer at datacompusa.com> To: javascript at lists.evolt.org> Date: Wed, 16 Jul 2008 08:52:53 -0400> Subject: Re: [Javascript] SAFARI javascript major problem> > Troy,> > On Jul 15, 2008, at 4:30 AM, Troy III Ajnej wrote:> > > The:> > alert(document.styleSheets[0].rules[0].selectorText);> > will not work inside the script body.> > -Of course it will work, if, and only if there are no external > > stylesheets> > presently linked to the document, but that's pointless & useless > > equally.> > Sorry I took so long to get back to you. I just got back from > vacation and I am still wading through the backlog.> > Thanks for bringing up this question. It has been educational for me.> > if you link your stylesheet like so: href="test.css" type="text/css"> then > alert(document.styleSheets[0].rules[0].selectorText will work just > fine in Safari. The properties for document.styleSheets[0].rules[0] are> selectorText: body> style: [object CSSStyleDeclaration]> parentStyleSheet: [object CSSStyleSheet]> cssText: body { }> type: 1> parentRule: null> > However, if you _import_ your stylesheet like so:> > the structure of the css is different and your first rule is an import > rule which doesn't have selectorText. If you display the properties > of document.styleSheets[0].rules[0] you get> > href: test.css> styleSheet: [object CSSStyleSheet]> media: [object MediaList]> parentStyleSheet: [object CSSStyleSheet]> cssText: @import url("test.css") ;> type: 3 parentRule: null> > My guess is that ie and firefox are replacing the import rule with the > contents of the imported file, while Safari is creating a hierarchy > that matches the way you have specified your stylesheet in the DOM. > You can get what you want in Safari by following the styleSheet object > like so> > document.styleSheets[0].rules[0].styleSheet.rules[0].selectorText> > or you can change the html to only use linked stylesheets.> > Sorry i don't have better news, but at least we now understand how > Safari works in this case.> > Roger> --> Roger Roelofs> Datacomp Appraisal Services> 3215 Eaglecrest, NE> Grand Rapids, MI 49525> > _______________________________________________> Javascript mailing list> Javascript at lists.evolt.org> http://lists.evolt.org/mailman/listinfo/javascript _________________________________________________________________ With Windows Live for mobile, your contacts travel with you. http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_mobile_072008 From lester at denhaag.org Wed Jul 16 11:16:17 2008 From: lester at denhaag.org (J. Lester Novros II) Date: Wed, 16 Jul 2008 18:16:17 +0200 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <23CC9276-0C86-4B51-B03B-443E33F5226D@datacompusa.com> <0A023390-65B7-45C5-9D7C-59855A8666D9@datacompusa.com> Message-ID: <487E1ED1.4040403@denhaag.org> Troy III Ajnej wrote: > The complete demo code is here [snip snip snip] This worx as expected in Firefox 3.0/Linux, Safari 3.1.2/Apple, Opera 9.51/Linux, xPloders 6, 7 & 8/WinXP: ------------------------------- code start ------------------------- Safari Bug Not working on Safari! ------------------------------- code end ------------------------- with the caveat that xPloders 7 & 8 return rulesLength as 1 more than the actual number of rules in the style sheet. Moral of the story: try to avoid running scripts before the page has loaded completely as much as possible. l8R lES -- m$' business is scaled and its cost structure is optimized for really, really big numbers of mindless and fairly undemanding customers. Robert X. Cringely http://www.supermarionation.tv From trojani2000 at hotmail.com Wed Jul 16 16:54:03 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Wed, 16 Jul 2008 21:54:03 +0000 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: <487E1ED1.4040403@denhaag.org> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <23CC9276-0C86-4B51-B03B-443E33F5226D@datacompusa.com> <0A023390-65B7-45C5-9D7C-59855A8666D9@datacompusa.com> <487E1ED1.4040403@denhaag.org> Message-ID: Hello, Novros. You are replying to a non existing question||problem same time.I already posted the "only how", that shall work in Safari. Exactly the one you've just posted... -But that's worth of about two dead flies. This issue is related to global variable stylesheet coll assignement, but as far as this release, it's impossible to achieve in Safari. Not even if you explode it. But all others work as expected. p.s.: your "caveat" remark on "as 1 more thanthe actual" is incorrect! But this is some other story... Regards.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Date: Wed, 16 Jul 2008 18:16:17 +0200> From: lester at denhaag.org> To: javascript at lists.evolt.org> Subject: Re: [Javascript] SAFARI javascript major problem> > Troy III Ajnej wrote:> > The complete demo code is here> > [snip snip snip]> > This worx as expected in Firefox 3.0/Linux, Safari 3.1.2/Apple, Opera > 9.51/Linux, xPloders 6, 7 & 8/WinXP:> > ------------------------------- code start -------------------------> > 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">> > > > > content="text/html; charset=utf-8">> > Safari Bug> > rel="stylesheet"> type="text/css">> > > > > Not working on Safari!> > > > > > > ------------------------------- code end -------------------------> > with the caveat that xPloders 7 & 8 return rulesLength as 1 more than> the actual number of rules in the style sheet.> > Moral of the story: try to avoid running scripts before the page has> loaded completely as much as possible.> > l8R lES> -- > m$' business is scaled and its cost structure is optimized for really,> really big numbers of mindless and fairly undemanding customers.> Robert X. Cringely> http://www.supermarionation.tv> _______________________________________________> Javascript mailing list> Javascript at lists.evolt.org> http://lists.evolt.org/mailman/listinfo/javascript _________________________________________________________________ Keep your kids safer online with Windows Live Family Safety. http://www.windowslive.com/family_safety/overview.html?ocid=TXT_TAGLM_WL_family_safety_072008 From rer at datacompusa.com Thu Jul 17 12:41:47 2008 From: rer at datacompusa.com (Roger Roelofs) Date: Thu, 17 Jul 2008 13:41:47 -0400 Subject: [Javascript] SAFARI javascript major problem In-Reply-To: References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> <23CC9276-0C86-4B51-B03B-443E33F5226D@datacompusa.com> <0A023390-65B7-45C5-9D7C-59855A8666D9@datacompusa.com> <487E1ED1.4040403@denhaag.org> Message-ID: Troy, On Jul 16, 2008, at 5:54 PM, Troy III Ajnej wrote: > Hello, Novros. > > You are replying to a non existing question||problem same time.I > already posted the "only how", that shall work in Safari. > Exactly the one you've just posted... Try this in Safari, ff and ie. I think you will find that Safari (and perhaps Opera, untested) is allowing the javascript to continue to execute at the same time the css is loading and ff and ie are causing the javascript to stop until all the stylesheets are loaded. ---------------- code ----------- Safari Bug

Page Loaded

---------------- code ----------- In short, if you wait until the onload event, all the major browsers play nice. If you try before onload, different browsers behave differently. Roger -- Roger Roelofs Datacomp Appraisal Services 3215 Eaglecrest, NE Grand Rapids, MI 49525 From lester at denhaag.org Fri Jul 18 18:07:05 2008 From: lester at denhaag.org (J. Lester Novros II) Date: Sat, 19 Jul 2008 01:07:05 +0200 Subject: [Javascript] Safari CSS problem revisited Message-ID: <48812219.10704@denhaag.org> Earlier I wrote: > with the caveat that xPloders 7 & 8 return rulesLength as 1 more than > the actual number of rules in the style sheet. It turns out I was mistaken. A more thorough investigation shows that both xPloders return the number of /selectors/ rather than the number of /rule bodies/. So, when I have a stylesheet like this: html, body { overflow-x: auto; } p { background-color: green; } div, span { background-color: yellow; } Firefox et al return 3 for rules length whereas xPloder returns 5. It also only returns the first of the selectors if there is more than 1, i.e. when asked for the selector text of the first rule in the above sheet, it returns 'HTML' [in upper case] rather than 'html, body', which is what the others do. I thought I'd let the list know to avoid any confusion. l8R lES -- m$' business is scaled and its cost structure is optimized for really, really big numbers of mindless and fairly undemanding customers. Robert X. Cringely http://www.supermarionation.tv