[jquery-dev] jQuery(document).ready() Type error on WebKit based Browsers
(cross-posted on the users' group... hope this is the correct forum) My site works fine on Firefox and IE, but on Webkit-based browsers, any call to jQuery(function() {}) results in this error on line 83 of jquery-1.3.2.js -- TypeError: Result of expression 'jQuery( document ).ready' [undefined] is not a function Basically, the jQuery.fn object is not getting extended with ready, hover, etc I have isolated the actual crash to line 2238 of jquery-1.3.2.js. if ( div.getElementsByClassName("e").length === 0 ) return; I threw a try/catch block around the code and receive this exception - NOT_SUPPORTED_ERR: DOM Exception 9 I am currently running Safari Version 4 Public Beta (5528.16), but apparently this bug is occurring in v3 as well (and of course, Chrome). By ignoring exceptions generated from the above, and the equivalent line 2 statements later, my page loads and everything executes perfectly. _jason --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] jQuery.ajax cross domain request with script
Hi there, I am having a problem with the cross domain issue that AJAX has. According to jQuery.ajax documentation, it should handle cross domain request with "script" and "jsonp" as data type. However, I cannot manage to get the following works: function getGeoLocation() { var location; alert('started'); $.ajax({ type: "GET", url: "http://j.maxmind.com/app/geoip.js";, success: function () { alert('success'); location = geoip_city(); }, error : function () {alert('error');}, dataType: "script" }); alert(location); alert('finished'); } There is no error according to FireBug, all alerts were executed except the ones in 'success' and 'error' functions. The above example is very similar to something in Ubiquity developed by Mozilla, it works even with dataType: "text", but in the 'success' function, it passed down a parameter and eval it. (I wonder whether in Mozilla it has a proxy to handle such request) jQuery.getScript() can handle cross domain request for sure, and it is based on jQuery.ajax with hardcoded dataType: "script", however, I still want to have the request made on jQuery.ajax because it provides more controls. Can anyone please let me know why my example does not work, thanks!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: #3981 IE 6 & 7 reports incorrect CSS opacity values in jQuery 1.3.1
Sweet. I like more simple (even though I tend to find the more complicated route). :) and ... yeah I accidentally removed the check from elem.currentStyle while I was trying other things. :( Thanks for pointing it out. -- Brandon Aaron On Thu, May 14, 2009 at 12:55 PM, Matt Kruse wrote: > > On May 14, 9:55 am, Brandon Aaron wrote: >> Fixed in r6439 (http://dev.jquery.com/changeset/6349). > > This seems simpler: > > var ret=""; > if ( !jQuery.support.opacity && name=="opacity" && elem.currentStyle ) > { > if ((elem.currentStyle.filter||'').match(/opacity=(\d+)/)) { > ret = (parseFloat(RegExp.$1)/100)+''; > } > } > > since currentStyle will reflect the value being set inline or via a > css rule. Also, it's necessary to verify that currentStyle exists, > since it can't be assumed just because the jQuery.support.opacity > check failed (inferring its existence is just as bad as browser > detection). > > (btw, I tested the above code on a sample case, but not against the > test suite) > > Matt Kruse > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: #3981 IE 6 & 7 reports incorrect CSS opacity values in jQuery 1.3.1
On May 14, 9:55 am, Brandon Aaron wrote: > Fixed in r6439 (http://dev.jquery.com/changeset/6349). This seems simpler: var ret=""; if ( !jQuery.support.opacity && name=="opacity" && elem.currentStyle ) { if ((elem.currentStyle.filter||'').match(/opacity=(\d+)/)) { ret = (parseFloat(RegExp.$1)/100)+''; } } since currentStyle will reflect the value being set inline or via a css rule. Also, it's necessary to verify that currentStyle exists, since it can't be assumed just because the jQuery.support.opacity check failed (inferring its existence is just as bad as browser detection). (btw, I tested the above code on a sample case, but not against the test suite) Matt Kruse --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: #3981 IE 6 & 7 reports incorrect CSS opacity values in jQuery 1.3.1
The ticket I opened on this (#3502) was closed as a duplicate, but it had a patch I wrote that addressed this issue. It required two changes: 1. The attr function would need an additional parameter -- the css collection's parent. 2. Once the filter was removed, the parent.currentStyle.filter property was checked to see if there was a default opacity assigned. I gathered that my patch was considered overkill for the situation, but it did solve the problem for me. JK -Original Message- From: jquery-dev@googlegroups.com [mailto:jquery-...@googlegroups.com] On Behalf Of Brandon Aaron Sent: Thursday, May 14, 2009 7:56 AM To: jquery-dev@googlegroups.com Subject: [jquery-dev] Re: #3981 IE 6 & 7 reports incorrect CSS opacity values in jQuery 1.3.1 Fixed in r6439 ( http://dev.jquery.com/changeset/6349 ). This actually brings up an interesting issue in regards to fixing clear type in IE when using filters. Most people just remove the filter if opacity is set to 1 or 0. However, you really have to double check to make sure it is actually set to 1 or 0 after removing it in-case the style sheet has a different opacity value. In which case it does, you'd have to do some trickery and potentially loose/overwrite the value in the style sheet. -- Brandon Aaron On Thu, May 14, 2009 at 5:20 AM, Jörn Zaefferer wrote: > > I'd like to give this ticket (http://dev.jquery.com/ticket/3981) a > bump, after stumbling about the same problem while trying to animate > an element with fadeIn, which has an opacity value set in a > stylesheet. > > The attached patch fixes the problem in my case. It duplicates parts > of whats already there for parsing the filter value, but otherwise it > looks fine. > > Any reason not to commit it to get it included in 1.3.3? > > Jörn > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: #3981 IE 6 & 7 reports incorrect CSS opacity values in jQuery 1.3.1
Thanks Brandon for commiting! Jörn On Thu, May 14, 2009 at 12:20 PM, Jörn Zaefferer wrote: > I'd like to give this ticket (http://dev.jquery.com/ticket/3981) a > bump, after stumbling about the same problem while trying to animate > an element with fadeIn, which has an opacity value set in a > stylesheet. > > The attached patch fixes the problem in my case. It duplicates parts > of whats already there for parsing the filter value, but otherwise it > looks fine. > > Any reason not to commit it to get it included in 1.3.3? > > Jörn > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: #3981 IE 6 & 7 reports incorrect CSS opacity values in jQuery 1.3.1
Fixed in r6439 ( http://dev.jquery.com/changeset/6349 ). This actually brings up an interesting issue in regards to fixing clear type in IE when using filters. Most people just remove the filter if opacity is set to 1 or 0. However, you really have to double check to make sure it is actually set to 1 or 0 after removing it in-case the style sheet has a different opacity value. In which case it does, you'd have to do some trickery and potentially loose/overwrite the value in the style sheet. -- Brandon Aaron On Thu, May 14, 2009 at 5:20 AM, Jörn Zaefferer wrote: > > I'd like to give this ticket (http://dev.jquery.com/ticket/3981) a > bump, after stumbling about the same problem while trying to animate > an element with fadeIn, which has an opacity value set in a > stylesheet. > > The attached patch fixes the problem in my case. It duplicates parts > of whats already there for parsing the filter value, but otherwise it > looks fine. > > Any reason not to commit it to get it included in 1.3.3? > > Jörn > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: new $
to do that you need to change the contructor: function(selector, context) { if(this instanceof jQuery) throw new Error("Can not new $()"); return new jQuery.fn.init(selector, context); } this means an extra if for each jQuery call, something not that welcome for performances reason. At the same time, jQuery itself relies in this JavaScript peculiarity, so I would not create "conflicts" between jQuery developers and users. If a user uses new $ this user simply does not truly understand/know JavaScript but fortunately will not harm anybody. On Thu, May 14, 2009 at 10:23 AM, DBJDBJ wrote: > > > Ah, new $, is possible and therefore not barred ... Left in there as a > sort of a land-mine for the newcomers ? Or as an esoteric test for GC > developers ? Highly useless it seems to me. > > Back to reality and jQuery. $ is defined as: > > function(selector, context) { >// The jQuery object is actually just the init constructor > 'enhanced' >return new jQuery.fn.init(selector, context); >} > > Maybe I am just searching for ECMA "harmony", but will $() definition > that throws an exception if new-ed , be usefull : > > try { >new $ ; > } catch ( x ) > { >// x. message == "Can not new $()" > } > > Au-contraire : will this hurt anyone ? Is exception throwing > porgramming idiom damaging for jQuery? > > --DBJ > > PS: if Python was choosen as a Netscape scripting language, World > would be a better place ... If nothing else its name is less > ridiculous ... ;o) > > On May 14, 9:04 am, Andrea Giammarchi > wrote: > > it's called JavaScript :D > > > > jokes a part, every function is a constructor as well so new function is > > always valid. > > > > If the function returns an object, it does not matter which "new" is > because > > it will be an instance of returned object one. > > > > if it is a primitive it will simply be lost: > > > > var a = new function(){return 123;}; > > // a is an instance of anonymous function > > > > this allows us to create Python like initializations: > > > > function PythonLike(){ > > return this instanceof arguments.callee ? this : new > arguments.callee; > > > > }; > > > > alert(PythonLike() instanceof PythonLike); > > alert(new PythonLike() instanceof PythonLike); > > > > true in both cases > > > > jQuery returns a new jQuery.prototype.init where init method shares the > same > > prototype ... better now? :-) > > > > On Wed, May 13, 2009 at 11:57 PM, DBJDBJ wrote: > > > > > Why is this allowed : > > > > > var jq = new $ ; > > > > > Does it matter? > > > > > -- DBJ > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: My findings with the jQuery.support collection in 1.3.2-vsdoc and IE 8
> isn't the vsdoc- version the one with the comment in the header that > says "don't use this, it is just for code completion internally"? I wonder if it would help to put this at the top of the file: alert("Yer doin' it wrong!"); If that doesn't break the Intellisense usage it would save a couple of "bug reports" a month. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] #3981 IE 6 & 7 reports incorrect CSS opacity values in jQuery 1.3.1
I'd like to give this ticket (http://dev.jquery.com/ticket/3981) a bump, after stumbling about the same problem while trying to animate an element with fadeIn, which has an opacity value set in a stylesheet. The attached patch fixes the problem in my case. It duplicates parts of whats already there for parsing the filter value, but otherwise it looks fine. Any reason not to commit it to get it included in 1.3.3? Jörn --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: Widget system
GOOD : interface X { } ; class A implements X { } ; BAD : class Y { } ; class B inherits Y { } ; Also, please do not feel sorry for me, I use JavaScript only when necessary ;o) PS: Tvoj english uopste nije los ... -- DBJ On May 14, 6:17 am, Robert Katić wrote: > I suppose you ALWAYS use delegation to define an is-a class > relationship. > If so, I am sorry for you. > > Inheritance is an easier way to define an is-a relationship. > Unfortunately it is often overused. > Unfortunately changes to super-class can easily break sub-classes, > specially in script languages where there is no good separation > between interfaces and implementations... > Mixins ($.extend) suffer same problems. > > An possible solution of this problems is to implement "explicit > overriding" (like C#). > It's not hard to implement, but it would probably make inheritance > unnecessary harder to use, specially in JS, where it is probably that > sub-class and super-class is defined by same programmer. > > However I think that inheritance is an powerful tool in hand of good > programmers. > > Sorry for my English. > > On May 14, 1:07 am, DBJDBJ wrote: > > > "Inheritance is Evil" ... > > >http://www.berniecode.com/writing/inheritance/ > > > --DBJ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: new $
Ah, new $, is possible and therefore not barred ... Left in there as a sort of a land-mine for the newcomers ? Or as an esoteric test for GC developers ? Highly useless it seems to me. Back to reality and jQuery. $ is defined as: function(selector, context) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init(selector, context); } Maybe I am just searching for ECMA "harmony", but will $() definition that throws an exception if new-ed , be usefull : try { new $ ; } catch ( x ) { // x. message == "Can not new $()" } Au-contraire : will this hurt anyone ? Is exception throwing porgramming idiom damaging for jQuery? --DBJ PS: if Python was choosen as a Netscape scripting language, World would be a better place ... If nothing else its name is less ridiculous ... ;o) On May 14, 9:04 am, Andrea Giammarchi wrote: > it's called JavaScript :D > > jokes a part, every function is a constructor as well so new function is > always valid. > > If the function returns an object, it does not matter which "new" is because > it will be an instance of returned object one. > > if it is a primitive it will simply be lost: > > var a = new function(){return 123;}; > // a is an instance of anonymous function > > this allows us to create Python like initializations: > > function PythonLike(){ > return this instanceof arguments.callee ? this : new arguments.callee; > > }; > > alert(PythonLike() instanceof PythonLike); > alert(new PythonLike() instanceof PythonLike); > > true in both cases > > jQuery returns a new jQuery.prototype.init where init method shares the same > prototype ... better now? :-) > > On Wed, May 13, 2009 at 11:57 PM, DBJDBJ wrote: > > > Why is this allowed : > > > var jq = new $ ; > > > Does it matter? > > > -- DBJ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---
[jquery-dev] Re: new $
it's called JavaScript :D jokes a part, every function is a constructor as well so new function is always valid. If the function returns an object, it does not matter which "new" is because it will be an instance of returned object one. if it is a primitive it will simply be lost: var a = new function(){return 123;}; // a is an instance of anonymous function this allows us to create Python like initializations: function PythonLike(){ return this instanceof arguments.callee ? this : new arguments.callee; }; alert(PythonLike() instanceof PythonLike); alert(new PythonLike() instanceof PythonLike); true in both cases jQuery returns a new jQuery.prototype.init where init method shares the same prototype ... better now? :-) On Wed, May 13, 2009 at 11:57 PM, DBJDBJ wrote: > > > Why is this allowed : > > var jq = new $ ; > > Does it matter? > > -- DBJ > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~--~~~~--~~--~--~---