Option tags inhert the "disabled" property of the select box in Chrome & Safari
In Chrome and Safari, option tags inherit the disabled property their parent select. Therefore, $("select option:disabled"); returns ALL option tags if the select box is disabled, even though the disabled attribute of each option is not explicitly set. This is probably the desired behavior. In FF 2-3.6, IE 6-8, and Opera 10, option tags do not inherit the disabled property. Test case: http://jsfiddle.net/FBBYE/1/ Ticket: http://dev.jquery.com/ticket/6211
jQuery 1.4.1 doesn't handle live namespaced events
In jQuery 1.3.2 you could create live namespaced events by doing this: $('div').live('click.name', function(){ console.log('hello'); }); In jQuery 1.4.1 this results in the event never firing. Looks like this is missed in the test cases. We probably need to test adding and removing live namespaced events. Looks like someone has already created a ticket for this: http://dev.jquery.com/ticket/5945
Possible bug: .closest( '*', DOMnode )
I believe I found a bug... .closest( '*', DOMnode ) will select the closest element whether or not it is inside the DOMnode. jQuery 1.4.2, tested on Chrome and FF. Cheers, Stephen.
jQuery 1.4.2 : JSLInt Report
John Resig may have already totally responded to this in the last couple of days, but I believe he encouraged me to post this here (anyway): Quoting from comp.lang.javascript: (If, by chance, this looks bad as reposted below, you can read it here: http://tinyurl.com/yc6gf5m .) On Mar 1, 11:11 am, lorlarz <lorl...@gmail.com> wrote: > On Mar 1, 10:22 am, lorlarz <lorl...@gmail.com> wrote: [snip] > > The problems I would _really_ like to see addressed are what > > JSLInt saw as *big problems* and
You can get the .bind event namespace, but what about the .trigger namespace?
So, you can get the .bind event namespace via event.handleObj.namespace, but what about the .trigger namespace? I don't see any way to get that value inside an event handler. Right now, you can use event.type to have one callback handle multiple events. Now, imagine that you could use event.namespace to have one callback handle multiple namespaces as well... You could just $(elem).bind( 'event', fn ); and throw any number of namespaces at a function that programatically handles them all. Like, do
Bringing filter support to live method
One of my live methods was not working. So I started looking into the code without realizing that live does not support filter method. Anyway I patched the code to make live support filter method. I am learning both JavaScript and jQuery and hence I am submitting it a bit hesitantly . Here is my commit http://github.com/neerajdotname/jquery/commit/b1744a93a66ba3068513ab5b7275d5e1a08b1761 Logic is simple. I am converting following selctor "#container a.filter(.top).filter(.first)" to ['#container
6 tests are failing
I was mucking with jQuery and then I ran test to make sure that I did not break anything. 6 tests failed. Then I ran jquery tests without any of my changes. Still 6 tests are failing. Just FYI.
git tags / qunit
Hi all, I was able to make some great progress tonight on normalizing jquery tests running in envjs with a generalized qunit bridge for envjs I've been working on. we had a bash script that switched on versions to checkout and run the tests, some via svn at google code and more recent versions at github. I noticed that tags in github go way back 1.0 (wow!). I'd like to simply and extend our support for coverages of jquery releases. Realizing that qunit has evovled a lot over time, is there any
QUnit::equiv Envjs Rhino/SpiderMonkey
I'm currently trying to get Envjs on Rhino compliant with jQuery 1.4.x and QUnit.equiv is giving me a bit of trouble. Not because of an actual bug but only because when properties of a Node are enumerated for deep equivalence checking (which is good) the properties are not enumerated in the same order (which can be bad). I'm sure 99% of dev's are aware of this rhino/spidermonkey difference but it's not normally an issue. Unfortunately rhino enumerates parentNode before childNodes and that leads
Stuck in 1.3 reference when I want to see 1.4
(Hope this is okay here. Don't know where to put documentation/site problems...) I'm very confused. Jquery.com's 'Documentation' link leads to docs.jquery.com but the only really handy reference (now, post-1.3.x) is api.jquery.com. I don't see the reason for the split, and since there's no similar link to api.jquery.com, how is anyone supposed to get there? Did I change some setting I can't edit now or something? I could have sworn before I got to api.jquery from the plain jquery.com site... Either
no optimization for :eq, :lt, :first
Doing a $(document.body).find("*:lt(10)")takes just as long as $(document.body).find("*")so I think it's getting all elements and then selects the first 10. It should be optimized to only get the first 10 elements in the first place and not go through the whole tree pointlessly. Same thing happens for :eq and :first. Both should stop once the required element was found.
implications of: (xhr.status == 0) => "success" and $.parseJSON("") => null)
Hi. I've encountered one issue after upgrading to 1.4.2. My app uses GET requests with data type json and I started receiving 'null' when server is down. After a bit of investigation I found a reason for that. In 1.4.0 empty json response generated "parserror" status, but in 1.4.2 it gives "success" with null data. It was done in commit 781fe8b8 which is fix for http://dev.jquery.com/ticket/5859. json.org is not very clear about (in)validness of empty string, but window.JSON parser gives exception
Problem with .find and attribute selector when attribute have escaped special character
Test Case: <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <div id="MyDiv"> <input name="NS$MYFIELD" /> </div> <script> var x = jQuery("#MyDiv"); alert(jQuery("input[name=NS\\$MYFIELD]").length) //1; alert(x.find("input[name=NS\\$MYFIELD]").length) //0; </script> </body> </html> Firebugging it: Stack: find() > Sizzle() > Sizzle() > filter() > ATTR() 3284 return result == null ? 3285 type === "!=" : 3286 type
usefullness of a piece of code in jQuery.clean
Hello, I would like to know how useful would be those code lines in jQuery.clean (line 4362) : if ( ret[i].nodeType === 1 ) { ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script")))); }And what would be the follow up if I comment those lines? It would be very kind of you to answer me. regards, Florent Edit : I use jQuery 1.4.1
Objects with toString work in html, append, etc
It might be nice to do something like: Dog = function(){} Dog.prototype.toString = function(){ return "woof"} dog = new Dog() $("#foo").html(dog) This can be solved super easy, I just feel like this would already work if it was meant to.
bubbleBind might be a useful to entice developers
http://www.bitsandpix.com/entry/jquery-bubblebind-jquery-plugin-to-bind-bubbling-events/ $("#parentDiv").bubbleBind("span","click",function(){ alert("you clicked on an span tag: " + $(this).html()); }); I developed a dead-trivial jQuery plugin to make binding of bubbling event as similar as possible to the traditional jQuery direct binding. While doing a jQuery.bind and jQuery.is is not hard it itself, the current API tends to make the default bind to be direct which could have serious performance
outerHeight(int) sets the height taking into account padding and border
I'm often wanting to set the outerHeight of an element. Currently I have to figure out manually the padding and border to make sure I am setting the height() correctly. Would jQuery accept a patch that by providing an integer height to outerHeight, it will set the height. The idea is if you should be able to do: $foo.outerHeight( $bar.outerHeight() ) And no matter what border / padding $foo might have, it will still look the same size as $bar. I bet this is a rather common problem and will add
Use JS hack-reference to improve speed
Hello! I found on "wtfjs.com" a method to do JS-reference, as the & in php. MAYBE this can improve JS. This is the basic idea: function x(object){ // I need re-use object on another method reUse(object); // I suppose that JS copy object to reUse function console.log(object); // Here is different, JS will pass a reference of object, but it's strange... reUseAgain(arguments); console.log(object); } function reUse(object){ object = 1; } function reUseAgain(object){ object[0] = 1;
Using jQuery in strict mode generates a lot of warnings.
Hello! When using jQuery in JavaScript strict mode, the library generates a lot of warnings. These warnings tend to be valid, pointing to problems waiting to happen. It also makes analyzing your own code tedious. To reproduce: Start an up-to-date version of Firefox. Enable the strict mode by entering about:config in the address bar and setting javascript.options.strict to true. Run JS code that makes use of jQuery - ideally a test suite which covers all code paths of the library. Review the
jQuery 1.4.2 .data() unexpected behaviour
Initially interrogating an unset .data() member returns null (typeof == "object"). After querying the .data() object itself, further tests return the expected 'undefined' for unset data members. This behaviour is present in 1.4.2 and differs from 1.3.2...I haven't yet tested intermediate versions to see where the behaviour was introduced. It's been tested on both FF3.6 and Safari 4.0.4 This is breaking some code which checks for typeof == "undefined" to test for an unset .data() value. The following
An update is available for the native JSON feature in Internet Explorer 8
http://support.microsoft.com/kb/976662 --DBJ
Bug with new HTML Creation Syntax?
$("<table />", {id: "someId1"}) //this works great $("<table cellpadding=\"0\" cellspacing=\"0\" />").attr("id", "someId2") //this works as it always did, but... $("<table cellpadding=\"0\" cellspacing=\"0\" />", {id: "someId3"}) //boom! I'm not sure if that's intended behavior or not, but it seems like the third line should work.
Problem with click on select boxes (webkit)
It seems that on webkit (or at least safari) when you bind a function to click on a select box it doesn't fire until the second time you click it. e.g. <select id="test"><option value="1">First</option></select> <script> $('#test').click(function() { alert('test') }); </script> This may be a problem with safari, but is there any way to work around this? I've also tried mousedown, but it doesn't seem to work as well as click (in FF and IE).
"elems is undefined" JavaScript error calling $(this).text() in .replaceWith() argument
I get a JavaScript error, "elems is undefined", when I call $(this).text() in a function which is a .replaceWith() argument, and .replaceWith() is called on an empty set of elements e.g. assuming the selector '.foo' matches no elements, then I get this "elems is undefined" JavaScript error running the following, $('.foo').replaceWith(function () { return '<div>' + $(this).text() + '</div>'; }); Here's a test page which throws this "elems is undefined" error,
A suggestion to facilitate computed values and automatic repainting in plugin components
Not sure if this functionality is already available but... If a plugin component has defined getValue() and setValue() methods and the core jQuery.val([value]) method delegates to those accessor methods (if they exist), then a component can support computed values and automatic repainting like the HTML form fields do.
If you are tracking jQuery bugs on commits this chrome extension might be useful
https://chrome.google.com/extensions/detail/hmgjfmlhbojmehdghpfnofdekdhmbcik?hl=en-us
Setting opacity overwrites other filters in IE
Hey.. Not sure if this is the best place to report this, but anyhow..(if not where's best?) Line 4602 of jQuery 1.4.2: style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : opacity; ... overwrites any other filters that are set (I'm greyscaling first), spose it should be: style.filter = ralpha.test(filter) ? filter.replace(ralpha, opacity) : filter + opacity; In the short term I'm just +='ing my greyscale filter after setting the opacity instead of before. Cheers John..
creating elements - arguments
Hi, I might be missing something, and apologies in advance if I am, but it seems at the moment to create elements the syntax is something like $("<tagname>", props); I was wondering if it was possible to change it to something like $("<tagname>", content, props) content being a string ... or possibly even another jquery object so that it would be possible to do the following: $("<p>", "Hello World") or $("<div>", $("<a>", "jQuery").attr("href", "http://www.jquery.com/") ).addClass("something");
why so much use of .split() in jQ instead of just an array?
was just browsing the source and noticed that there are a lot of places where there is a space-separated list of stuff in a string (sometimes multiple stings concatenated) followed by a .split(). in the places i saw it used, it's done just on init, so speed really isnt a factor. but why not just have an array? why this: props: "altKey attrChange attrName bubbles button".split(" ");rather than this?: props: ['altKey','attrChange','attrName','bubbles','button']; the only benefit i see is character
any estimate as to when jQuery 1.4.2 will be released?
I am experiencing this bug (http://dev.jquery.com/ticket/5851) and I am wondering when it will be fixed in a stable version of jQuery. The bug report says "# milestone changed from 1.4.1 to 1.4.2 " but I haven't heard anything about 1.4.2.
Rolling my own jQuery Core
Hey guys, Sadly I am working a project that requires me to use Dojo 1.3 and, well, it's not the best for traversing. So, I'd like to grab the jQuery code only for selecting and traversal. So looking at http://github.com/jquery/jquery/tree/1.4.2/src I am thinking I need only core.js, sizzle-jquery.js, and traversing.js. So my questions are, are they the only files I need and in what order should they be place? I'm looking at the current uncompressed release (http://code.jquery.com/jquery-1.4.1.js)
Bad example in bind docs on api.jquery
http://api.jquery.com/bind/ The bind docs have a bad example under "Stop only an event from bubbling by using the stopPropagation method." It includes a use of event.stopPropagation in which it tests for existence and falls back to using event.cancelBubble exclaiming it's for IE support. jQuery handles the issue with IE internally, this is bad use of jQuery (unnecessary because it doesn't apply since stopPropagation always exists, even in ie) and shouldn't be in the official docs.
RequireJS as a require() for jQuery
I would like to offer a require() function as provided in RequireJS as a script loader for jQuery. While RequireJS can be used today without integration into jQuery core, there are benefits with integrating RequireJS, similar to how Sizzle is integrated, with jQuery core: export jQuery as a module to be used by the module system supported by RequireJS The "baseUrl" to find all scripts would be relative to jquery.js more robust handling of async scripts that should be loaded before jQuery.ready()
Can 'bind' please be added to 'jQuery.attrFn'?
I can't think of any conflicts that may result from this change. I realise that most (all?) of the native DOM events that jQuery explicitely supports (e.g. click, mouseover, mouseout, load) are already available in jQuery.attrFn, but adding custom events is still a nuisance... this would make it so much simpler: jQuery('<div/>', { bind: { customEvent: function(){} } });
Problem with CSS class on SELECT
Here is a sample code to explain the problem: CSS part: option.sel { color:red } HTML part: <select id="test"> <option value="1" selected>1</option> <option value="2">2</option> <option value="3">3</option> </select> jQuery part: $("#test option:selected").addClass("sel") When testing this sample code on several browsers, I get different results: On IE8 the selected option is red on the current selected box, but is still black into the popup list On FF or Chrome the selected option is still black
Is jQuery 1.4.2 faster than Dojo 1.4.1 on TaskSpeed?
John, you wrote in another forum that jQuery 1.4.2 is faster than the latest Dojo on TaskSpeed. Is it really faster? This would be a huge improvement. Les
jQuery.each()
This was started almost a year ago. jQuery.each() improvement. Inside it, instead of : for ( name in object ) { if ( callback.apply( object[ name ], args ) === false ) { break; } } One would expect to see : for ( name in object ) { if ( ! Object.prototype.hasOwnProperty.call( object, name )) continue ; if ( callback.apply( object[ name ], args ) === false ) { break; } } Now this is somewhat controversial, beacuse we all know this will slow down this function. But it is perphaps inevitable, since
$.require before onload doesn't prevent onload in Chrome
After trying out $.require in Chrome, it seems like if you use it before onload, it doesn't make onload wait for all scripts (like it does in IE and FF). I know you can do this by using document.write in Webkit based browsers. Is there another way? Surprisingly, it doesn't seem to work if you append to the body.
undefined as request body for ajax calls in Chrome
(reposted, the original was having problems) There's a ticket open for this issue for 1.3.2, but I've encountered the problem in 1.4.1 as well as the nightly. I've updated the ticket with what I think the root cause is -- a Chrome bug -- and my proposed solution. I believe the simplest fix is setting jQuery.ajaxSettings.data to null instead of leaving it undefined. Comments?
Jquery crash bug on IE8 using .attr() method
Jquery doesn't support namespaced attributes, which is fine, but it shouldn't crash when they are used. The enclosed file demonstrates that querying for .attr('ex:role') inside a table causes jquery to crash (silently) and interrupt processing. This forum claims it won't let me upload my sample html file, so I'm enclosing the source here. Or, you can visit http://people.csail.mit.edu/karger/jquery-bug.html <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js"
Next Page