This is a follow up to John's http://forum.jquery.com/topic/templating-syntax I'm going to break it up into small post because I'm having issues with the forum WYSIWYG on MAC FF if I accidently hit shift+delete and have lost several posts, and I'm a lot shy of wasting time trying to write on it now.
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 point at which qunit and jquery versions are not both in alignment with a simple clone/branch/checkout from git?
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 to an immediate infinite recursion. I might be able to figure out how to force rhino to enumerate properties in a different order but I thought it might benefit QUnit to expose a couple currently hidden hooks so I can at least get past the issue and even better eventually easily 'plugin' an appropriate equiv.hoozit to better deal with the issue on rhino.
In general this is all that's needed to allow a QUnit user to manipulate QUnit.equiv to suit their needs:
@line 866 inside QUnit.equiv //allow extension/overriding of deep type checking routines innerEquiv.callbacks = callbacks; return innerEquiv;
This allows me to hook into "object", "array" etc.
Just a little better would be a hook into QUnit.equiv.hoozit, but it requires a more substantial rewrite to allow hooks via a switch or something based on typing. I'll just hint at that for now and will provide a suggested patch as soon as I have a chance.
Thanks a ton, Thatcher
PS. I am using QUnit on a new project for testing a python server-side project at the Library of Congress and have it running with continuous integration via Hudson with Envjs. The new QUnit reports are beautiful and are published by writing out the resulting html. I'm writing a little QUnit/jQuery plugin to allow previous tests to be saved and loaded without rerunning but still allowing the collapsible tests and toolbar functionality. I'll post the plugin soon but want you to know I really appreciate the latest QUnit.
qunit is looking great but I need to port the changes. Is there a good resource to look at to help me update my jqUnit extensions to QUnit extensions?<br clear="all"> -- Christopher Thatcher
Hey devs, I've been watching all the progress to 1.4 and I'm just wanting to applaud you all for you efforts. You are so responsive and open to feed back and seeing so much of the jquery I've known for years now, which is solid and concise being improved even more. Really, a huge inspiration.<br clear="all"> -- Christopher Thatcher
Hi all, We've got envjs passing about 1350 tests with jquery 1.3.2 and in many cases the tests that are failing make sense because, for example we haven't implemented external stylesheet support, or an ajax get to a local php file doesnt make sense. So really there are just a handful of meaningful error left. Below are a couple comment/questions: 1. I can't figure out this test... test("add(String|Element|Array|undefined)", function() { ... ok( jQuery([]).add( document.getElementById('form') ).length >= 13, "Add a form (adds the elements)" );<br clear="all"> }); I'm not able to grep why a form element is treated specially with add, or where in the source the single element returned from document.getElementById becomes more than a dozen. Its probably something im overlooking but I don't see mention of it in the docs, so it's probably a dom property specific to forms thats checked for? (2 & 3 are comments) 2. I've noticed that the qunit function equals(a,b,c) is not used very consistently to communicate which of a or b is the 'expected' value and which is the 'actual' value. this starts to hurt my brain eventually as I try to track down issues. I know it's not a big deal. 3.We are still working on integrating an html compliant parser and/or providing a html to xml tidy filter, in the mean time the only error we get from the jquery unit tests in that realm is from qunit itself when it does the following: $('<input type="checkbox" id="filter-missing">') though just a few lines above it does close the input tag with $('<input type="checkbox" id="filter-pass" />') so i was thinking this might have been a minor over sight. Thanks! Thatcher -- Christopher Thatcher
Hey jQuery Community, I wanted to announce another feather in jQuery's hat. The new Library of Congress Metasearch application was quietly released today and the interface is entirely driven with jquery and jquery-claypool. It's a single url app that is all ajax after that so make sure you turn off firebug unless you want a big performance hit. cheers to the jQ Links: <a href="http://www.loc.gov/">http://www.loc.gov/</a> This is the general Library of Congress site. To access the app, just use the search box in the upper left. <a href="http://www.loc.gov/fedsearch/metasearch/">http://www.loc.gov/fedsearch/metasearch/</a> This is the application itself. <a href="http://www.loc.gov/fedsearch/metasearch/?cclquery=resig">http://www.loc.gov/fedsearch/metasearch/?cclquery=resig</a> -- Christopher Thatcher
I am trying to catch up to 1.3.2 as a general developer and in particular as a contributor to john's envjs project. In particular I've been trying to make the global window and document object references scope-able inside closures so that a single shell can manage multiple instancse. I'm not having much luck and might give up but I'm trying to understand if it's even possible. I was looking at the 1.3.2 source and noticed a treatment of window that I'd never seen before and frankly am a bit perplexed by it. in 1.3.2 line sixteen sets the window equal to the jQuery sources anonymous closure scope. And window continues to be referenced throughout in what is apparently a mixture of traditional and non-traditional ways. is this possible? at what points are the global window object and jquery closure window the same and different. can someone give me a brief summary of the pattern so I can see if it's something I can make use of in envjs? thanks a ton and especially to John and Yehuda.<br clear="all"> -- Christopher Thatcher
with a couple caveats but i thought i would share in case folks are interested. <a href="http://jquery-claypool.appspot.com/">http://jquery-claypool.appspot.com/</a> is running serverside javascript with envjs, jquery, and claypool in googles appengine. caveats: you can't use setTimeout or async xhr as google doesn't allow apps to create threads. ajax only supports http protocols, and inline scripts aren't allowed as google doesnt allow access to the local file system. all in all i'm amazed at how easy it was to get working. i did find and patch a little bug in envjs xhr implementation that caused an error when copying response headers. the latest was pushed to github.<br clear="all"> -- Christopher Thatcher <br clear="all"> -- Christopher Thatcher
not a big deal but envjs complains about this line in qunit because its current parser isnt graceful with non-xml markup. <input type="checkbox" id="filter-missing"><br clear="all"> should be <input type="checkbox" id="filter-missing"/> -- Christopher Thatcher
I noticed we where using an older testrunner.js with envjs even when running 1.3.2 unit tests. i start playing with it and realized qunit works great and i can even use QUnit.done to output a static html file with the result of running the tests in envjs. the only snag I had was being able to hook to QUnit.log . this may be a bug with envjs implementation of onload so please feel free to point out if im mistaken. here is the script that initiates it: load("build/runtest/env.js"); (function($env){
//let it load the script from the html $env.scriptTypes = { "text/javascript" :true };
var count = 0; window.onload = function(){
//this doesnt work because onload isn't called until after the tests run QUnit.log = function(result, message){ $env.log('('+(count++)+')['+((!!result)?'PASS':'FAIL')+'] ' + message ); };
//this works because done is called from syncronize() QUnit.done = function(pass, fail){ //write resulting window less scripts to an html file jQuery('script').each(function(){ this.type = 'text/envjs'; }); $env.writeToFile( document.documentElement.xml, $env.location('jqenv.html') ); };
};
window.location = "test/index.html";
})(__env__); I was wondering if you could either add a synchronized 'begin' or let log just be global $.extend(window, { ///... log: log?log:function(result, message); }); thanks thatcher -- Christopher Thatcher
Announcing jQuery-Claypool (<a href="http://docs.jquery.com/Plugins/Claypool">http://docs.jquery.com/Plugins/Claypool</a>) jquery-claypool is a small, concise, fast, railable javascript application framework, built as a jquery-plugin that provides all the usual important patterns for large, long-lived client-side apps, server-side apps, or something strangely, beautifully in the middle.
like django, rails, and spring but built for jquery. jquery-claypool provides a powerful routing framework, simple scanners for nearly-zero configuration, highly optimized category logging, aspect oriented filters, automagically managed inversion of control, single point of entry, swappable environments and minimal requirement mvc. and if all of those big words don't scare you away, jquery-claypool will make your life simpler, cheaper, and most importantly lazier. cheers to lazy. jquery-claypool is both a client (browser) and server-side framework that fits in a compressed, gzipped file that is smaller than jquery itself. we can achieve this by simply allowing you to use whatever model and view plugins you love the most, while simultaneously letting you write controllers the same way you would write event handler without jquery-claypool. i.e. there is no notion of framework required extension patterns. you decide how you like to write and we just wire it up cleanly and most importantly, transparently. dependencies * works with jquery 1.2.6 and 1.3.2(client) * requires livequery (soon we will add live()) Download / fork / watch jquery-claypool at github <a href="http://github.com/thatcher/jquery-claypool/tree/master">http://github.com/thatcher/jquery-claypool/tree/master</a> Join the discussion group / mailing list at Google Groups: <a href="http://groups.google.com/group/jquery-claypool">http://groups.google.com/group/jquery-claypool</a> Report any bugs you find on the bug tracker <a href="http://claypooljs.lighthouseapp.com/">http://claypooljs.lighthouseapp.com/</a>
I have a difficult problem and I'm sorry to post such a general question to the dev list but I dont expect to find an answer elsewhere, and I'm hoping a javascript master may have some creative solution. The library of congress is unifying it's search process, it's a 'heavy' javascript solution, and jquery is being used. Originally objtree.js was used to transform the xml messages (getting json is unfortunately not an option currently). Profiling showed I was getting a heavy hit in objtree so I made some minor modifications to jquery.xslt.js to setup a simple client-side xslt pipeline. the good news it works in ff2/3 - ie5/6/7 - opera9/10 but chrome1/2 and safari9/10 fail for content delivered from 3 of 6 targets. the 3 failure targets use consistent utf-8 encoding surprisingly. I found the following: In the webkit engine there was, or is, apparently a problem parsing javascript with some utf-8 characters: <a href="http://code.google.com/p/chromium/issues/detail?id=2015">http://code.google.com/p/chromium/issues/detail?id=2015</a> <a href="http://code.google.com/p/chromium/issues/detail?id=176">http://code.google.com/p/chromium/issues/detail?id=176</a> This is apparently fixed though I still experience the problem. The important point is the javascript is generated from xml on the client with xslt, no errors, clean utf-8, but parsing it fails with an unhelpful 'unexpected_token ILLEGAL'. I'm sort of tearing out my hair out but have plenty of other things to keep me busy. Has anyone else run into issues with a clever solution? Again, apologies for a post not specific to the dev of jquery, just hoping someone with more experience has an idea. Thanks Thatcher<br clear="all"> -- Christopher Thatcher
I was wondering if there was any interest I could stir up in the experienced plugin developer community to participate in volunteering to act as mentors for less experienced plugin developers get projects ready for release by providing constructive criticism and feedback about what work a plugin needs before it's release. I'd personally be very grateful for some mentoring so I can get my project out to the community without making common mistakes.<br clear="all"> -- Christopher Thatcher
If your unlucky enough to have to develop on a windows machine you might get errors when running the unit tests in rhino with the UTF-8 selectors. I resolved this in 1.2.6 and 1.3.1 by modifying the Makefile to use JAR = java -Dfile.encoding=utf-8 -jar ${BUILD_DIR}/js.jar Thanks!<br clear="all"> -- Christopher Thatcher
<div dir="ltr">I would occasionally like to use dialog as (essentially) a light box, which is very easy to do and saves the additional plugins when I'm already using jquery ui. The one thing I can't seem to figure out is how to hide, or prevent from appearing at all, the dialog resizable-handles that are the border of the dialog. My basic recipe is: $(this).dialog($.extend(this.dialogOptions||{}, { modal: true, resizable:false, height: $(document).height(), width: $(document).width(), overlay: { opacity: 0.2, background: "black" } }));<br clear="all"> I've tried modifying the css in firebug to see if I can figure out the css that would need to be modified, but I can't find the right property. Thanks for any insight. -- Christopher Thatcher </div>
<div dir="ltr">One thing I didnt understand after the jquery conference was the specific algorithm behind the unique id that helps to distinguish runtime jquery instances when multiple are present. I know I could look at the code and I have before, but I still wouldnt probably have a numerical measure of its strength as a guid. If it is strong enough, practically, why doesnt the core simply expose a .guid() method and use this internally while also providing it externally (it would save my plugins from reproducing it.)<br clear="all"> -- Christopher Thatcher </div>
<div dir="ltr">So I did sit up and pay attention at the conference when I learned that events could be bound to pure javascript objects and not just the dom. I also am attempting to replace some code I have for simple data caching with $().data() . The question is, can I bind data to pure javascript objects and not just dom elements, and if not does it make sense to extend the same analogy the .bind() uses to allow this? <br clear="all"> -- Christopher Thatcher </div>
<div dir="ltr">I'm trying to understand the cost differential of binding events to objects versus binding events to the dom. It obviously depends on how many things I''m binding to (eg 100 similar objects or 100 similar dom elements) in that I can generally take advantage of delegation wiith the latter, but don't have the cost of the bubble/trickle with the former. Have any performance/scaling tests been implemented? Or is it a mute point and I don't know why?<br clear="all"> -- Christopher Thatcher </div>
<div dir="ltr">I'm trying to book a room (or sleep under a couch) relatively close to the event but I can't find the location (still listed as TBD on the pages I can find). Can you at least post a general area of the Boston metro? Thanks and looking forward.<br clear="all"> -- Christopher Thatcher </div>