Re: [mochikit] Does anyone use this?
Whoa. Blast from the past. Mochi was way ahead of the curve 10 years ago. I used it last around 2009. At that point jquery had sort of taken the position, as I remember it. For sake of a bit of code archeology, there were definitely other tool kits even before Mochi. I think xb (xbrowser?) was one of my go-to staples for a while. T On Fri, 26 May 2017 at 05.01, Chaz Gatianwrote: > I stumbled upon MochiKit for the first time tonight, and it completely > blew my mind. > > I started web development eight years ago, and have never heard of such a > tool. It's so interesting to read the blogs, and issues from the past. From > what I can tell this library seems like the first framework to try to solve > all the different browser quirks, something I always thought jQuery was the > first to accomplish. But now having learned about this framework, I might > be *VERY *wrong! > > If anyone still frequents this group please say something, I'm curious to > know if anyone is still using this in applications today. > > -Chaz > > -- > You received this message because you are subscribed to the Google Groups > "MochiKit" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to mochikit+unsubscr...@googlegroups.com. > To post to this group, send email to mochikit@googlegroups.com. > Visit this group at https://groups.google.com/group/mochikit. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "MochiKit" group. To unsubscribe from this group and stop receiving emails from it, send an email to mochikit+unsubscr...@googlegroups.com. To post to this group, send email to mochikit@googlegroups.com. Visit this group at https://groups.google.com/group/mochikit. For more options, visit https://groups.google.com/d/optout.
Re: [mochikit] Re: Server side Javascript logging
Really? This thread is more than 4 years old. I'm sure jslogger is a fine product, but this is just border line of spam. On 26 May 2013 18:20, Dumitru Glavan dumitru...@gmail.com wrote: You might try JSlogger http://jslogger.com - we built it exactly for the same reason. We have a couple of single page apps in production with heavy Javascript and we have to log all the exceptions out there. It supports mobile devices as well and backend logging through NodeJS. So far, we are happy with it. Worth to give it a try. On Tuesday, 13 January 2009 14:43:55 UTC+1, Jesper wrote: Hi MochiKit people, I am a happy MochiKit and Javascript amateur using MochiKit for my personal marine weather forecast site: http://www.worldwildweather.**com http://www.worldwildweather.com (I am still struggling with a few Javascript issues so please do not kill me if it does not work) During the real world testing of my web site my users have encountered some Javascript errors. To facilitate debugging and to build a more robust application I would like to log Javascript errors and info (using MochiKit.Logging) and send it back to my server for analysis. Has anyone got an example showing how this is done or maybe just some pointers to get me started. Best regards, Jesper -- You received this message because you are subscribed to the Google Groups MochiKit group. To unsubscribe from this group and stop receiving emails from it, send an email to mochikit+unsubscr...@googlegroups.com. To post to this group, send email to mochikit@googlegroups.com. Visit this group at http://groups.google.com/group/mochikit?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups MochiKit group. To unsubscribe from this group and stop receiving emails from it, send an email to mochikit+unsubscr...@googlegroups.com. To post to this group, send email to mochikit@googlegroups.com. Visit this group at http://groups.google.com/group/mochikit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[mochikit] Re: getElementById
var url = document.getElementById(url).value; but if you're using MochiKit, you could shorten it to: var url = $(url).value; -- troels 2009/1/25 Boštjan Jerko ml...@japina.eu: Hello! I have an HTML page from which I'd like to read username data and url to my javascript, for example: ... form name=podatki input name=uname id=uname value=user1 type=hidden/input input url=url id=url value=http://www.mochikit.com; type=hidden/input /form a href=# onClick=jscript()link/a in jscript.js the code is: function jscript() { uname=document.geElementById(uname); url=document.getElementById(url); log(uname); log(url); } I expected to get from log user1 and http://www.mochikit.com, but I got [object HTMLInputElement] I guess that is correct but how to get data from HTML page?? Hope I was clear with the question. Boštjan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to mochikit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Server side Javascript logging
You can try hooking a handler up to window.onerror although this chart suggests that it may only work on certain browsers: http://www.quirksmode.org/dom/events/index.html Maybe there are some browser-specific alternatives for those that don't support this. -- troels On Thu, Jan 15, 2009 at 9:48 AM, niek.kouwenb...@gmail.com niek.kouwenb...@gmail.com wrote: First - I would always use POST for this. If you catch error, shouldn't you use the message of error? Not anything you've logged... Re-trowing the error is a good idea, nothing changes for the end user. On 15 jan, 09:32, Jesper jesper.webm...@gmail.com wrote: Hi Niek, On Jan 14, 11:15 am, niek.kouwenb...@gmail.com niek.kouwenb...@gmail.com wrote: Catch the JavaScript errors with a try-catch construction, and send the catched error to a logging URL on your server, like: http://www.worldwildweather.com/log.php?message=catched error message Thanks, I will definitely do that. I guess that I can use the MochiKit logging method: var msg = logger.getMessageText(); to send the get all logged information (although I might need to either put a limit on the size of the message or use a post request). I would definitely also want to catch unanticipated errors. Would you do that by putting the entire onload method in a try-catch construction where the error is reraised (since I would of course not just cause my users browsers to silently ignore an error) after sending a log to my server: window.onload = function() { try { ... } catch(error) { var msg = logger.getMessageText(); sendToMyServer(msg); throw error; }; }; Or do you have a better approach? Best regards, Jesper --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to mochikit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Ajax request returns
On Sun, Oct 26, 2008 at 4:20 AM, Arnar Birgisson [EMAIL PROTECTED] wrote: Have you tried... AjaxUpdater = function (id, page) { var d = doSimpleXMLHttpRequest(page); d.addCallback(function (req) { getElement(id).innerHTML = req.responseText; adding it here ... If I'm not mistaken, you can't access nodes through the DOM api immediately after assigning through innerHTML. The nodes don't exist until the current event has ended. A simple solution is to set a timeout of 1 millisecond and do it in there. Eg.: AjaxUpdater = function (id, page) { var d = doSimpleXMLHttpRequest(page); d.addCallback(function (req) { getElement(id).innerHTML = req.responseText; setTimeout( function() { // adding it here }, 1); ... -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: MochiKit 1.4 released
On Wed, Oct 22, 2008 at 12:01 AM, Arnar Birgisson [EMAIL PROTECTED] wrote: Per: Many thanks for taking matters by such firm hands lately. I hope the countless people begging for a release here realize what kind of an effort it is. We do. It's appreciated. -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Preparing for a MochiKit 1.4 release
On Wed, Oct 8, 2008 at 5:07 PM, Per Cederberg [EMAIL PROTECTED] wrote: In Opera 9.50 Beta 2 they added support for getBoundingClientRect, so then the test won't break anymore (taking another code path inside MochKit.Style.getElementPosition actually). Would that be ok with you? A little late to reply, but .. I think it's fair to expect Opera users to have the latest version installed. 9.5 may still be beta, but not for long. It would be nice to get some tests on mobile browsers though. Anyone? -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Class inheritance
On Wed, Oct 8, 2008 at 12:56 AM, Akari no ryu [EMAIL PROTECTED] wrote: Troels, the problem with using prototypical inheritance is that you end up losing scope in, for example, AJAX request responses or DOM event handlers. If you want to keep scope in an event handler, you can delegate to it, using a closure: connect( 'myID', 'onclick', function() { foo.bar(); }); Or, if you prefer, you can use the MochiKit-provided `bind` function, to do the same: connect('myID', 'onclick', bind('bar', foo)); -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Preparing for a MochiKit 1.4 release
On Wed, Oct 8, 2008 at 3:54 PM, Per Cederberg [EMAIL PROTECTED] wrote: Opinions? What does Bob think? Hooray. On Wed, Oct 8, 2008 at 3:54 PM, Per Cederberg [EMAIL PROTECTED] wrote: You can also contribute by running the test suite in your favorite browser environments. Below is a link and the results as of today. http://svn.mochikit.com/mochikit/trunk/tests/index.html Here's what I have within immediate reach: Ubuntu Linux 64bit: Firefox 3.0.3 (64bit) .. OK 9.50 Alpha .. 8 failures in test_MochiKit-Style.html not ok - initial x position: got 444, expected 400 not ok - initial y position: got 111, expected 100 not ok - updated x position: got 544, expected 500 not ok - updated y position: got 211, expected 200 not ok - updated x position (using relativeTo parameter): got 444, expected 400 not ok - updated y position (using relativeTo parameter): got 111, expected 100 not ok - updated only x position: got 344, expected 300 not ok - not updated y position: got 211, expected 200 Windows XP 64bit: Opera 9.60 .. OK Firefox 2.0.0.14 .. OK Google Chrome 0.2.149.27 .. OK Safari 3.1.1 (525.21) .. OK Internet Explorer 7.0.5730.13 .. OK Windows XP 32bit: Internet Explorer 6.0.2900.2180.xpsp_sp2_gdr.050301-1519 .. OK Safari 3.1.2 (525.21) .. OK -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Class inheritance
I never used `bindMethods`. I can see why a Pythonista might find it intuitive, but quite frankly, it's reveals a fundamental misunderstanding of the language being used. Javascript does not have classes, and trying to emulate them is going to be a very leaky abstraction. You would be much better off using the features that the language supports (prototypical inheritance). Maybe the documentation should include a note about this, under `bindMethods`? -- troels On Mon, Oct 6, 2008 at 5:40 PM, Akari no ryu [EMAIL PROTECTED] wrote: Ok, I've searched through the archives for posts referencing the word inheritance but most of them are just referring to prototype and the lack of scope that JS gives you if you don't bindMethods(this) I'm asking about actual OO inheritance in this post, wherein a class inherits methods from another class. I've also tried google but that was utterly useless. Gave me suggestions for code which doesn't work when you're using MochiKit, because of the bindMethods function. I've added a bequeathTo method to my helper class which does the following Helper.prototype.bequeathTo = function(other) { for(var i in this) { other[i] = MochiKit.base.bind(this[i], other) } } That works. It's been tested and implemented in two classes that inheret methods from it. I'll upload my code for linkage later. I don't know if all y'all want to implement this but I though I'd post just in case. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: MochiQuery
On Tue, Jun 17, 2008 at 6:23 AM, machineghost [EMAIL PROTECTED] wrote: So before I waste a bunch of time trying to fix such issues, I thought it might help to ask if anyone else had played around with this sort of thing before. Or for that matter, is anyone actually using anything like this? If so, I'd love to hear about your experience. Jeremy It's almost the hallmark of MochiKit, that it _doesn't_ pollute the global namespace, like a lot of other libraries do. The problem in mocking around with core prototypes, is that you can break code that would otherwise work. Of course, you can't run Mochikit together with Prototype today either, but that's the fault of Prototype and not of Mochikit. Besides that, what's the benefit of writing thing the other way around anyway? Mochikit uses a function-oriented syntax, while jQuery use an object-oriented syntax. I find that this helps me to think function-oriented, rather than object-oriented, and generally I think that's a good thing. ( An interesting blog post about that topic exactly: http://michaelfeathers.typepad.com/michael_feathers_blog/2008/05/are-fp-and-oo-i.html ) -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: MochiQuery
On Tue, Jun 17, 2008 at 5:07 PM, machineghost [EMAIL PROTECTED] wrote: 1. Chainability: with this syntax you can chain functions do stuff like: someObject.update(updateObject1).update(updateObject2); True, that _is_ something that can't be done with function-oriented syntax. Personally, I'm not that found of this fluent interfaces style; I think it works fine for simple cases, but lose it's punch when things get more complex. Plus it can get a bit unintuitive, when taken out of context. But I understand, that some people like it. The way jQuery's api works, should make it possible to provide some of these things without messing with built-in prototypes, I reckon? You could simply return wrapper objects, which have the methods available? I don't even remember if jQuery does this? On Tue, Jun 17, 2008 at 5:07 PM, machineghost [EMAIL PROTECTED] wrote: Actually, come to think of it 5.counter() wouldn't even work (since 5 is scalar, it doesn't inherit object.prototype methods). But hopefully you get the idea. It works. 5 is a scalar, but it's automagically wrapped in an object, when used as such. -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: other widget toolboxes most compatbile with mochikit?
On Sun, Feb 17, 2008 at 7:05 AM, Jason Bunting [EMAIL PROTECTED] wrote: Others?! These are the only ones I know of and have ever heard of - while there is nothing wrong with people developing their own MochiKit-based stuff There is plotkit: http://www.liquidx.net/plotkit/ And I made a couple of widgets, a while ago: http://candyscript.com/projects/minikit/ I would be nice with a MochiKit 3rd-party repository. If I had had the time, I would have volunteered for creating one, but like everybody else on this list, I don't. Since javascript libraries are usually quite small, I think the infrastructure must look a bit different than most other repositories. Integrating the support for in-browser running of test and demonstrations, would be very nice. -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: 1.4, again
On 10/16/07, Daniel Fetchinson [EMAIL PROTECTED] wrote: Five months ago someone posted a list of blocking bugs: On May 15, 9:57 pm, sayrer [EMAIL PROTECTED] wrote: http://trac.mochikit.com/ticket/113 http://trac.mochikit.com/ticket/226 http://trac.mochikit.com/ticket/228 http://trac.mochikit.com/ticket/241 http://trac.mochikit.com/ticket/248 All of these have been fixed but the last, which has been switched to priority:low. For those of us not running from svn, is a 1.4 release on the horizon? (Remembering that it was almost done a year ago.) Or has everyone switched to jquery? :) -Jonathan What's wrong with running from svn? For me it was very stable so far. Following on the recent thread about activity, it would probably be good publicity to throw out an official milestone. It's bordering on arrogant to assume that people who want to use MochiKit must be geeky enough to use SVN. Most javascripters aren't. -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: running alongside mootools?
It's been a while now, since I played around with moo, but the biggest problem is, that it's based on prototype, which means that there are plenty of overrides of built-in's (See: http://docs.mootools.net/Native/Array.js ). This makes it hard to use together with other libraries, and you can't isolate those changes with a namespace. On 9/19/07, iain duncan [EMAIL PROTECTED] wrote: For that matter, I'm also interested in hearing any mochikit users thoughts on mootools. At first glance they look like they could be complementary but I would love to hear from the trenches. Thanks! -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] fireNativeEvent
I don't recall if this has been discussed before, but I found myself in need of a cross browser way to fire a native event (In particular onchange) on a HTMLElement. After some sporadic research, I have put together the following function: /** * Fires a native HTMLEvent on an HTMLElement * element : HTMLElement The target element * eventName : string The name of the event to raise. Should be all lowercase and include the trailing 'on'. */ fireNativeEvent = function(element, eventName) { if (element.fireEvent) { // MSIE element.fireEvent(eventName); } else { // W3C var event = document.createEvent(HTMLEvents); event.initEvent(eventName.replace(/^on/, ), true, true); element.dispatchEvent(event); } } I tested this with an onchange-event for a input=text in IE7, FX2, and O9. Maybe it could be integrated into the signal() function, so one could simply do signal(element, onchange)? -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] extendURL
From time to other, I find myself needing to manipulate the query-string of URLs in javascript. I have put together the following function. Is this general enough to put into mk? extendURL = function(url, parameters) { var parts = url.split(/\?/); var base = parts[0]; var args = update(isUndefinedOrNull(parts[1]) ? {} : parseQueryString(parts[1]), parameters); var args2 = {}; for (key in args) { if (!isUndefinedOrNull(args[key])) { args2[key] = args[key]; } } if (keys(args2).length == 0) { return base; } return base + ? + queryString(args2); } assert(foobar?zim=cuxsalla=bim == extendURL(foobar?zim=cux, {salla: bim})); assert(foobar == extendURL(foobar?zim=cux, {zim: null})); assert(foobar?salla=bim == extendURL(foobar?zim=cux, {zim: null, salla: bim})); -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] fortifysoftware securityreport
This might be of interest. http://www.fortifysoftware.com/servlet/downloads/public/JavaScript_Hijacking.pdf -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: fortifysoftware securityreport
It can be done almost transparently, by simply replacing /^while\(1\);/ with in evalJSON(). This would leave data without the safeguard as-is. The only code it would brake, would be code that relied on having such code running, and that would be insane anyway ... I prefer while(1); over commenting code for two reasons. a) It generates an error (script hangs) on the malicious site. b) if a string contains the characters */, it would escape out of the safeguard with the commenting solution. On 4/3/07, Victor Bogado [EMAIL PROTECTED] wrote: This has worried me also. The problem is that the json load could be included in a rogue web page by using a script tag. Since the author of this page has total control of what he will display he can subvert the javascript interpreter to run whatever he like when the json object is executed (changing the array or object constructor). There are two solutions to this problem, one requires that the client side to prove that he actually knows the cookie by embedding some part of it in the URL of the request and denying people who don't know. Since Mochikit is not concern with the server side this does not really apply here. The second solution implies that JSON should not be directly runnable, by prefixing it with a 'while(1)' or commenting the whole thing for instance would be enough. But motchikit makes this hard by providing a simple, very simple, to use loadJSONDoc() function. I am a person who cares a lot with security, and if I were in charge of motchikit I would change the definition of the default JSONDoc used by kit to be a commented out javascript and would change the evalJSONRequest function to uncomment the data before it evaluate it. The problem is that this would break current behavior, in my opinion this is not bad, because it is simple enough to implement this on whatever server-side application you have and would also force the applications to use a more secure form of JSON. Another way is to call this new form of JSON something else like SJSON (secure json?) or CJSON (Commented JSON, witch is more honest since we can't know if this is 100% secure anyway) and create a evalCJSONRequest and loadCJSONDoc. This way it would not break the current insecure way of doing things but would give simple tools to people that want security on their sites to operate. My opinion is that the fisrt option is the best, I made a quick hack that do just that (I don't have the time to test it right now). the diff to svn version is posted bellow : Index: Async.js === --- Async.js(revision 1278) +++ Async.js(working copy) @@ -217,7 +217,9 @@ MochiKit.Base.update(MochiKit.Async, { /** @id MochiKit.Async.evalJSONRequest */ evalJSONRequest: function (/* req */) { -return eval('(' + arguments[0].responseText + ')'); + var re = new RegExp(^\s/\*(.*)\*/\s*$); + var json = arguments[0].responseText.replace(re, $1); +return eval('(' + json + ')'); }, /** @id MochiKit.Async.succeed */ === On Apr 3, 6:35 am, troels knak-nielsen [EMAIL PROTECTED] wrote: This might be of interest. http://www.fortifysoftware.com/servlet/downloads/public/JavaScript_Hi... -- troels -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: fortifysoftware securityreport
If the server-side doesn't send arrays, then it's not a problem and we don't need a new specification or any changes to the clients. If nothing else, it's probably a good thing to mention in the documentation. -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Simple callback/signal example please
That's because the button doesn't exist in the document tree until you add it in there with swapDOM. If you move the swapDOM line up before connect, it should work with either way. On 2/20/07, Dave Whiteley [EMAIL PROTECTED] wrote: I have written a trivial app which works on Firefox but not on IE and others. I have the handling of buttons and signals confused. So I have now tried this even simpler tester app. I have: ### !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head titleMochikit Button Tester/title meta content=text/html; charset=ISO-8859-1 http-equiv=content-type script src=js/MochiKit.js type=text/javascript/script /head body div id=testTest Here/div script var handler = function(e){ alert(in handler); } var but = BUTTON({'id':'testButton'},Hit Me); // Version ONE //connect('testButton','onclick',handler); // Version TWO connect(but,'onclick',handler); swapDOM($('test'),but); /script /body /html ### Version ONE of the connect fails with: src has no properties connect(null, onclick, function(), undefined) Version TWO works. In the documentation on connect I see:- connect(src, signal, dest[, func]): Connects a signal to a slot, and return a unique identifier that can be used to disconnect that signal. src is the object that has the signal. You may pass in a string, in which case, it is interpreted as an id for an HTML element. What have I missed? Also I read in the Docs: Using Signal for DOM Events When using MochiKit.Signal, do not use the browser's native event API. That means, no onclick=blah, no elem.addEventListener(...), and certainly no elem.attachEvent(...). but in the Mailing lists I see references (from Bob) to using onclick etc. In my original code I used the onclick=blah and it worked beautifully - but only on Firefox. So I am now trying to mend my ways. Please can someone point me as a simple example showing me the right (and wrong?) ways to connect handlers to form elements - that will work cross platform. Ta, Dave -- Dave Whiteley [EMAIL PROTECTED] Phone +44 (0)113 343 2059 Faculty of Engineering The University of Leeds. Leeds, LS2 9JT, UK -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Browse the Web faster than Internet explorer and Its free
STOP THINKING Don't waste Time Now that's an add with some serious attitude! -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: A IE problem - non-Mochikit JavaScript
--- A Runtime Error has occurred. Do you wish to Debug? Line: 154 Error: 'sucess' is not defined --- It's a typo - success and sucess. You should install Microsoft Script Debugger for IE. It's not firebug, but it does help a bit. On 1/30/07, Lee Eschen [EMAIL PROTECTED] wrote: Having lurked here for awhile now, I know you guys are very good with JavaScript in general. I hope it's not against protocol to ask a question outside of the Mochikit realm. I have a small site I'm developing for a client and in working towards greater accessibility for the sight-impaired, I cobbled together (standing on the shoulders of giants) a stylesheet switcher. It works just fine on every browser I have tested (Firefox 2.0.0.1, Netscape 7.2, Opera 9.00), except IE, both V6 V7. The test site can be found at: * http://www.ashgrovevisualarts.com/ivnews/ You should be able to see all the CSS and JS paths from reading the source. Nothing is hidden. The problem may be seen by clicking on the buttons Normal Text and Large Text on the right end of the lower bar in the heading. In FF, NS, Opera, the buttons perform as expected: * Normal: active area is 80% of viewport, p text is default size. * Large: active area is 100% of viewport, p text is 140% of default size, except head and foot. In IE 6/7, nothing happens except the error icon appears in IE7 only. Running in a FF IETab is the same. If I could run Firebug in IE, or in an IE Tab in FF, I could likely solve this quickly, but no such luck. Any suggestions to point me in the right direction? I appreciate any help you might be willing to give. I'm sure it's some small but obvious thing I'm just not seeing. -- Lee Eschen Ashgrove Visual Arts First is the sheer joy of making things. As the child delights in his mud pie, so the adult enjoys building things, especially things of his own design. I think this delight must be an image of God's delight in making things, a delight shown in the distinctness and newness of each leaf and each snowflake. --Frederick P Brooks in The Mythical Man-Month (1975) -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: DomContentLoaded?
I'm using the code from http://webreflection.blogspot.com/2006/09/better-domcontentloaded.html Works like a charm AFAIK. -- troels On 1/23/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I see that the ticket for a DomContentLoaded signal (http://trac.mochikit.com/ticket/192) has been moved to the 1.5 milestone. I'm a bit disappointed, because I was eager to use this! I may add it myself in the meantime, so I'm wondering -- are there complications, perhaps cross-browser issues, that make this a trickier issue than it seems? js --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Date Picker
There's this (Which I'm the author of): http://candyscript.com/projects/minikit/samples/date.html And then there's the calendar component from ui4w: http://ui4w.sourceforge.net/UI4W/packed/samples/browser.html -- troels On 1/10/07, Mulugeta Maru [EMAIL PROTECTED] wrote: Is there a date picker I can use with MochiKit? Thank you. Mulugeta --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Date Picker
On 1/10/07, Jorge Godoy [EMAIL PROTECTED] wrote: troels knak-nielsen [EMAIL PROTECTED] writes: There's this (Which I'm the author of): http://candyscript.com/projects/minikit/samples/date.html How I18Nized is it? How can I instruct it to show month names in pt_BR and use dd/mm/ instead of mm/dd/ format? The format is fixed, but you can adjust the month names by passing an optional parameter: datePicker($(foo), {i18n: {months: [ January, February, March, April, May, June, July, August, September, October, November, December ]}}); You can change the label for the optional null-checkbox as well, by supplying a key of nullValue to i18n. -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Date Picker
You colud try using dojo together with mochikit. There was a post about that recently: http://groups.google.com/group/mochikit/browse_thread/thread/69bf2f2b9dac2e70/ac72feaa754027fd -- troels On 1/10/07, Mulugeta Maru [EMAIL PROTECTED] wrote: I am looking for something like this http://archive.dojotoolkit.org/nightly/demos/widget/datePicker.html Thank you. Mulugeta --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: MochiKit.Date
The Javascript Date object is notoriously buggy. I would prefer an exception when supplying invalid input data. On 12/11/06, Bob Ippolito [EMAIL PROTECTED] wrote: It's not a bug, that's what the JavaScript Date object does. I don't see a particularly good reason to fix this. -bob On 12/11/06, Nirmal [EMAIL PROTECTED] wrote: Hi All, I noticed that the date library in MochiKit behaves differently, isoDate('2006-34-34') gives Mon Nov 03 2008 00:00:00 GMT+0530 (India Standard Time) The month and date values above are invalid. But it ads up to the date value, its like find the date of the day that is 34 months and 34 days after 2006-Jan'01. But the ISO 8601 spec specifies a limit on the values - MM = two-digit month (01=January, etc.) DD = two-digit day of month (01 through 31) So is this a bug in mochikit? I will be happy to fix it. ~ Prathap -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: getElementPosition versus Opera
Yep - it works. On 12/7/06, Thomas Hervé [EMAIL PROTECTED] wrote: I think it comes from an Opera bug for some element with a specific display. YUI already handles problem with 'inline', but I think there's also a problem with 'table-row'. Can you try the following patch: --- Style.js(revision 1233) +++ Style.js(working copy) @@ -295,8 +295,11 @@ if (tagName === 'BODY' || tagName === 'HTML') { break; } -c.x -= parent.scrollLeft; -c.y -= parent.scrollTop; +var disp = self.getStyle(parent, 'display'); +if (disp != 'inline' disp != 'table-row') { +c.x -= parent.scrollLeft; +c.y -= parent.scrollTop; +} if (parent.parentNode) { parent = parent.parentNode; } else { - Thanks, -- Thomas -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] getElementPosition versus Opera
I think, I've found a bug in MochiKit.Style.getElementPosition on Opera. When selecting the position of an element, contained in a table cell, the position isn't calculated correctly. Quirksmode findPos function gets the right result, for reference: http://www.quirksmode.org/js/findpos.html Test below: html head titlegetElementPosition vs Opera/title script type=text/javascript src=mochikit.js/script style type=text/css html, body { margin:0; padding:0; } /style script type=text/javascript quirksmode = {}; quirksmode.findPos = function(obj) { var curleft = curtop = 0; if (obj.offsetParent) { curleft = obj.offsetLeft curtop = obj.offsetTop while (obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop } } return {x: curleft, y: curtop, __repr__: MochiKit.Style.Coordinates.prototype.__repr__ }; } addLoadEvent(function() { $(debug).innerHTML = repr(getElementPosition($(street))); $(debug).innerHTML += br; $(debug).innerHTML += repr(quirksmode.findPos($(street))); }); /script /head body table tbody trtd style=height:100pxnbsp;/td/tr trtdimg src=# id=street alt=Element to get position from //td/tr /tbody /table div id=debug style=font-size:100pt;font-family:'trebuchet ms'/div div style=height:100px;width:10px;background-color:red;position:absolute;top:0;right:0;nbsp;/div /body /html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: How do you wait for an asyncronous event?
Deferred is happening asynchronous, so you can't think in incremental, imperative code. You pseuodosample could f.ex. be written as: div id=out/div input type=button id=btn value=clickme / script var onClick = function() { var onCheck = function(data) { getElement(out).innerHTML = data; } var d = loadJSONDoc(/foo/bar); d.addCallback(onCheck); } connect(getElement(btn), onclick, onClick); /script When The button is clicked, onClick is called. This calls loadJSONDoc. When loadJSONDoc is done, it calls local function onCheck. Hope this helps. On 11/13/06, .M. [EMAIL PROTECTED] wrote: Hi there. I'm having trouble using Deferreds to do some basic AJAX calls. Something fundamental I'm not clear on yet. With re. to the following fragment Q) Where does the callback function return its variable to? How can you access it? Q) How can you check whether the callback has happened yet from another function (e.g. business() below so that you don't continue until it's taken place? function check() { d.loadJSON(/foo/bar); d.addCallback(resultsItem); } function resultsItem() { // record the results of the checking someplace - where? checks = something; return checks; } function business() { check(); // don't go forward until results of check are handled do something reliant on check() being accurate; } Any help would be great! Thanks .M. -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: how to pan div contents
Show us your code. On 11/10/06, Diez B. Roggisch [EMAIL PROTECTED] wrote: Hi, I'm currently creating a TurboGears Tile-widget, like google maps has for example. So far things are smooth, displaying and moving work. Now what I would love to do is to enable that panning of the contents of that widget - moving around the tiles via dragging. I tried and look into the DragAndDrop-code, but for some reasons my feeble attempts don't work out - I get this error: Exception... 'Error: 'objOrFunc' must be a function if 'funcOrStr' is not given' when calling method: [nsIDOMEventListener::handleEvent] nsresult: 0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT) location: unknown data: no] This is Firefox 1.5 on mac os x, btw. The HTML looks like this: div id=tileswidget div !-- a column -- div !-- a tile -- img .../ spansome text/span /span ... /div ... /div I tried to connect various onmouse*-events from the tileswidget or the window - no success so far. Any hints on how to proceed? Regards, Diez -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: iterating through dictionary
Using Iter : forEach(r.items, function(item) { log(item); }); ... or even: forEach(r.items, log); On 11/10/06, .M. [EMAIL PROTECTED] wrote: Dol! I get it now for (x in r.items) { log(x); for (y in r.items[x]) { log(r.items[x][y]); } } -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] Re: Announcing MochiKit.Animator - an animation engine that doesn't suck
That is so cool. On 11/8/06, Karl Guertin [EMAIL PROTECTED] wrote: var animation = cssAnimation(color:red; opacity: 0.5,$('example')); animation.play(); Get it at: http://gr.ayre.st/~grayrest/animator/animator.html MochiKit.Animator is an enhanced, fully vectorized version of Bernard Sumption's animator.js [2]. It eschews the use of classes and instead uses composition to build complex effects in a few lines of code. Full explanation and demos at the above page. [2] http://berniecode.com/writing/animator.html -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~--~~~~--~~--~--~---
[mochikit] minikit
I have created a lightweight collection of widgets and visual effects (hereunder a port of moo.fx visual fx library), which are compatible with mochikit or can be used standalone. The package can be downloaded from: http://candyscript.com/projects/minikit/ -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Not sure how to properly pass parameters to connect().
Hey, thanks for correcting me. I remember reading about the allegedly optimization pitfall some years ago, and somehow just stored it in my memory as a piece of truth. I never even bothered to think it through, but your explanation makes perfectly sense. On 10/17/06, Bob Ippolito [EMAIL PROTECTED] wrote: Both you and the blog entry are confused here. That's not an optimization, that's how scope works in JavaScript. All implementations MUST do that. The quote he referenced is completely irrelevant to the behavior that his code has. Closures don't snapshot the state of the program.. they just reference the environment. If you change the value of a variable in that environment, it's going to show up as changed in the closure. In some languages, like Erlang, it's impossible for that variable to change because it's a single assignment language.. but this behavior happens in JavaScript, Python, Ruby, etc. -bob On 10/17/06, troels knak-nielsen [EMAIL PROTECTED] wrote: Apart from the obvious, that Bob had event.stop(); in his example (Which you could add if you need it, but most likely you don't), there is one peculiar detail. Some javascript interpreters optimize closures like this, so they can be reused if called multiple times. This would happen if you assign the closure in a loop, and might lead to oddities. If you use mochikit's Iter functions, this won't be a problem, and frankly it's fairly exotic any way. Here's a blog post explaining the problem : http://joust.kano.net/weblog/archive/2005/08/08/a-huge-gotcha-with-javascript-closures/ But in general, my solution will work, and since it's shorter and easier to read, I think it's preferable. On 10/17/06, Chris W. Parker [EMAIL PROTECTED] wrote: At Saturday, October 14, 2006 10:06 AM troels knak-nielsen said: Or simply: connect('target1', 'onclick', function() { change_html('target1', 'new html'); }); Sorry I'm replying to this just now. I don't get a lot of time to play with this everyday. Is there any functionality that I may be missing out on if I do it this way instead of returning the function the way Bob suggested? Thanks, Chris. -- troels -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Not sure how to properly pass parameters to connect().
Apart from the obvious, that Bob had event.stop(); in his example (Which you could add if you need it, but most likely you don't), there is one peculiar detail. Some javascript interpreters optimize closures like this, so they can be reused if called multiple times. This would happen if you assign the closure in a loop, and might lead to oddities. If you use mochikit's Iter functions, this won't be a problem, and frankly it's fairly exotic any way. Here's a blog post explaining the problem : http://joust.kano.net/weblog/archive/2005/08/08/a-huge-gotcha-with-javascript-closures/ But in general, my solution will work, and since it's shorter and easier to read, I think it's preferable. On 10/17/06, Chris W. Parker [EMAIL PROTECTED] wrote: At Saturday, October 14, 2006 10:06 AM troels knak-nielsen said: Or simply: connect('target1', 'onclick', function() { change_html('target1', 'new html'); }); Sorry I'm replying to this just now. I don't get a lot of time to play with this everyday. Is there any functionality that I may be missing out on if I do it this way instead of returning the function the way Bob suggested? Thanks, Chris. -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Not sure how to properly pass parameters to connect().
Or simply: connect('target1', 'onclick', function() { change_html('target1', 'new html'); }); On 10/14/06, Bob Ippolito [EMAIL PROTECTED] wrote: On 10/13/06, Chris [EMAIL PROTECTED] wrote: Hello, I'm just trying to do a really simple thing by setting an event on an element with connect() and then changing that element's html with innerHTML. But I'm not sure how to properly pass parameters through connect() to my function. I can see with MochiKit.Logging that the values ARE being passed but because of the error I'm getting the connect() function does not execute correctly. Here is my HTML: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head titleTest 6/title script type=text/javascript src=../mochi131/lib/MochiKit/MochiKit.js/script script function change_html (id, new_html) { e = MochiKit.DOM.getElement(id); e.innerHTML = new_html; MochiKit.Logging.log('i was clicked'); } function run_mystuff () { connect('target1', 'onclick', change_html); } MochiKit.DOM.addLoadEvent(run_mystuff); /script /head body div id=target1 asdf /div div id=target2 /div /body /html - If I change the line marked with stars to... connect('target1', 'onclick', change_html('target1', 'new html')); ...I get an error that says 'objOrFunc' must be a function if 'funcOrStr' is not given'. Like most languages in common use, function calls always execute exactly where they are in the code. What you're doing is actually this: var result = change_html('target1', 'new html'); connct('target1', 'onclick', result); That clearly is not what you want. If I hard code the values everything works fine. What do I need to change? You need a function that does what it needs to do using only the event parameter. A typical way to do this would be to use a function that returns a new function with the information you need. var make_change_html = function (target, replacement) { return function (event) { event.stop(); change_html(target, replacement); }; }; connect('target1', 'onclick', make_change_html('target1', 'new html')); -bob -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Please help me decide ideal implementation
Watch out for views in mysql. If the view contains a calculated field (such as MAX() etc.), mysql can't optimize the search correctly, which will result in full table scans, severely hurting performance. Views are bad for performance in mysql until they get this fixed. Indices are a really good idea on heavy tables, though. It sounds to me like you could gain a lot by rewriting your sql. The explain command is helpful here. On 10/11/06, Chris [EMAIL PROTECTED] wrote: Jorge Godoy wrote: You'll benefit if you use VIEWs and correct indexes. Another thing to think about is using prepared statements instead of reissuing the same query over and over: as with VIEWs the planner can optimize this and choose a better approach to retrieve your data. Yes I've heard about those but haven't used them yet as I'm using MySQL and I think it's new to MySQL. (If only I'd been using PgSQL! ;) ) Also put some limit to the minimum amount of information you should have before you touch the database. For example, when using this to auto search the name of a client don't go to the database with just one character; instead wait for something like 3 or 4 letters to be typed and only then go retrieving something from the database. Good idea. What doesn't make Bob's advice useless, since I believe you won't want everybody seeing how much each customer pays for your service... You're right, his advice wasn't useless. I just meant that there won't be anyway for a customer to search other customer's data. Only product info on the front. Sensitive data in the back. I will be using LAMP. As in Linux, Apache, PostgreSQL and Python? ;-) Nice choice. :-) haha No.. I'm using the standard definition. :) That may be what I need to do. s/may be/is/ ;-) We'll see. :) Chris. -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: is there a unique array function ?
Isn't that what filter does ? http://mochikit.com/doc/html/MochiKit/Base.html#fn-filter On 10/9/06, Bob Ippolito [EMAIL PROTECTED] wrote: On 10/9/06, b3d70 [EMAIL PROTECTED] wrote: I wanna know, is there any function in mochikit which can check each value of an array and produce a new unique array ? No, there is not. It's easy to write one that works only for string or number values, but it's somewhat difficult to write one that deals in other objects (unless they have a unique toString). -bob -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: CSS selectors
cssQuery is the best implementation I've seen, and it works nicely together with mochikit. It's a bit heavyweight too though : http://dean.edwards.name/my/cssQuery/ On 10/5/06, Arnar Birgisson [EMAIL PROTECTED] wrote: Hi all, Many javascript libraries have convenience functions for selecting elements with the CSS selector syntax (like prototypes $$ I'm told). Has anyone implemented something like that with MochiKit? Preferably supporting CSS3 selectors? Would you consider such a function a valuable addition to MochiKit? Arnar -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Mochikit vs. ?
Any comparison is bound to get very biased. There was a good comparison article at sitepoint a while back : http://www.sitepoint.com/article/javascript-library All of the libraries mentioned therein are cross-platform. Most javascript theese days are, since it's a lot easier to write cross-platform today, than it was 5 years back. On 10/4/06, Mehboob Alam [EMAIL PROTECTED] wrote: Not having delved into the intracacies of each AJAX toolset, I'm wondering if someone can point me to a pros and cons of the different AJAX libraries, and why Mochikit is better. I specifically need cross-platform support, i.e. FireFox, Safari, and Internet Explorer.. oops.. my previous message went to an individual, instead of the group. apologies.. sincerely, mehboob alam There cannot be a crisis next week. My schedule is already full. Henry Kissinger -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: setRequestHeader vs. IE
On 8/16/06, Bob Ippolito [EMAIL PROTECTED] wrote: On 8/16/06, troelskn [EMAIL PROTECTED] wrote: I ran into a wierd problem with XmlHttpRequest. It seems that IE for some reason lowercases the key of custom headers (such as X-Ajax-Engine) set with setRequestHeader(). Is this a known error of IE, or does the problem come from mochikit ? Definitely doesn't come from MochiKit, you're working with the raw XMLHttpRequest object. In either case, the server shouldn't care, headers are not case sensitive. -bob OK, Thought so - I just wanted to confirm it, and for some reason google didn't turn anything up on the subject. Thanks -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Fwd: [mochikit] scrollable table
It's pretty basic - you just call scrollTable() with a table element as argument. You can't use it on an element that hasn't been inserted to the dom tree, since it uses the parentNode to switch things around a bit (Your table is actually split into two tables). Here's a working sample, just for good meassure: html head script type=text/javascript src=mochikit.js/script script type=text/javascript src=scrolltable.js/script /head body table id=mylist thead tr thfoo/th thbar/th thtjim-dada/th /tr /thead tbody tr tdlorem ipsum/td tddolor sit amet/td tdlorem ipsum/td /tr tr tddolor sit amet/td tdlorem ipsum/td tddolor sit amet/td /tr tr tdlorem ipsum/td tddolor sit amet/td tdlorem ipsum/td /tr tr tddolor sit amet/td tdlorem ipsum/td tddolor sit amet/td /tr tr tdlorem ipsum/td tddolor sit amet/td tdlorem ipsum/td /tr tr tddolor sit amet/td tdlorem ipsum/td tddolor sit amet/td /tr tr tdlorem ipsum/td tddolor sit amet/td tdlorem ipsum/td /tr tr tddolor sit amet/td tdlorem ipsum/td tddolor sit amet/td /tr tr tdlorem ipsum/td tddolor sit amet/td tdlorem ipsum/td /tr tr tddolor sit amet/td tdlorem ipsum/td tddolor sit amet/td /tr /tbody /table script type=text/javascript scrollTable($(mylist), 10em); /script /body /html On 8/14/06, Ivo Beckers [EMAIL PROTECTED] wrote: Hi, Do you have a working sample online? I just wanna know how it can be applied to dynamically generated tables. Cheers, Ivo Op 11-aug-2006, om 14:01 heeft troelskn het volgende geschreven: Hi I made this little function the other day, which I find quite useful. If someone else want it, or even if you want to include it in mochikit, you're welcome. Basically, it makes a normal table's tbody vertically scrollable - something that css ought to be able to do for us, but alas ... Works in ie, ff and opera. (Although a bit quirky in ie). /** * Makes a regular table tbody-scrollable * * (c) Troels Knak-Nielsen, Public Domain * * Version : 11. aug 2006 */ scrollTable = function(table, /* optional */ height) { if (!height) { height = 10em; } var tablewidth = elementDimensions(table).w; var table2 = document.createElement(table); table2.className = table.className; var thead = table.getElementsByTagName(thead).item(0); var ws = []; forEach( thead.getElementsByTagName(tr).item(0).getElementsByTagName(th), function(th) { ws.push(elementDimensions(th).w); } ); var tbodies = table.getElementsByTagName(tbody); for (var i=0; i tbodies.length; ++i) { table2.appendChild(table.removeChild(tbodies[i])); } forEach( [table, table2], function(t) { forEach( t.getElementsByTagName(tr), function(tr) { var i = 0; forEach( tr.childNodes, function(node) { if (node.nodeName (node.nodeName.toLowerCase() == th || node.nodeName.toLowerCase() == td)) { node.style.width = ws[i] + px; ++i; } } ); } ) } ); var
[mochikit] Re: Iter forEach question: where is the index?
You can rewrite your code as ; var i = 0; forEach(togglers, function(e) { e.stretcher = stretchers[i]; i++; }); On 8/4/06, troels knak-nielsen [EMAIL PROTECTED] wrote: I asked the same question recently: http://groups.google.com/group/mochikit/browse_thread/thread/caa986a88bbee128/d046b70967e7001f#d046b70967e7001f On 8/4/06, bartb [EMAIL PROTECTED] wrote: Hi, I am porting my code from prototype to MK and also try to apply FP as much as I can. But, I'm a bit stuck... Is there a way to access some index/loop variable in a forEach? This is the code I want to change: togglers = getElementsByTagAndClassName('a', 'toggler') //a's where I click on stretchers = getElementsByTagAndClassName('div', 'stretcher') //div's that need toggling for (var i=0; itogglers.length; i++ ) { togglers[i].stretcher = stretchers[i] } ... When I change the for loop into a forEach, I loose the loop i variable which I need to access the other variable elements. forEach(togglers, function(e) { e.stretcher = stretchers[i] } ) Or is there an other function/way to do this in Mochi? Thanks, Bart -- troels -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Problem with tbody and blindUp et al
Doh. I thought it was included in the packed file. Why isn't it ? It still doesn't work properly with tbody, though. On 8/1/06, Thomas Hervé [EMAIL PROTECTED] wrote: You have to include the file New.js to use the Visual effects. The error is relatively clear, no ? It means the function makeClipping is not defined (because it's defined in New.js). -- Thomas -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: appear and fade makes ie6 memory to explode.
On 7/21/06, Alexandre A. Falcão [EMAIL PROTECTED] wrote: But still one question: There is any way to permanently destroy objects created by DOM API?? If you drop all references to it, even IE should be able to wipe it from memory ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: on(ready) signal for each class method during runtime
dojo toolit has some support for aop : http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book12 that said, i agree with bob - i don't see the need in javascript, where you can easily redefine methods during runtime. On 7/10/06, Bob Ippolito [EMAIL PROTECTED] wrote: On Jul 10, 2006, at 5:17 AM, beckie wrote: Are you considering to introduce AOP style features to MochiKit; like before, after, ...? I don't have any plans to, it doesn't seem terribly useful. -bob -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: MK vs Dojo vs YUI vs ?
Incidentially, this article may help comparing the various solutions around: http://www.sitepoint.com/article/javascript-library On 6/27/06, Bob Ippolito [EMAIL PROTECTED] wrote: On Jun 26, 2006, at 10:14 PM, [EMAIL PROTECTED] wrote: Newbie question alert... I am a very experienced web developer, but am trying to wrap my brain around all the AJAX/JS frameworks/libraries sprouting up over the last year (with which I have zero experience). I finally have the need to get into the game and am trying to make an informed decision. In searching this forum, I have gleaned a few nuggets about which I would appreciate some validation/elaboration: - According to Bob, Dojo is the only comparable toolkit to MK in terms of quality. This is based in part on respect of the global namespace and not prototyping/mangling the base js object. He has listed script.aculo.us, openrico, and prototype (some of which I have played with and thought were good in terms of the end result) as culprits. What about Yahoo UI? They use namespaces -- not sure about object.prototyping... I haven't looked much at Yahoo UI, but from what I understand it's largely just UI stuff. MochiKit mainly covers everything else. I've seen people use both. In its current state, MochiKit has been mostly developed by people who have UI needs that don't need a widget library or have widgets that are too customized for general usage. - What's the story between MK and Dojo? All of the chatter I have seen in the forum history is about using them together, porting calls from one to the other, etc. No one seems to be saying Use MK instead of Dojo. Bob in one thread mentioned that if Dojo had existed in present form 9 months ago MK may not have gotten started (paraphrasing). I have seen Alex Russel pop up in here from time to time too. There's a lot of overlap, but Dojo obviously fills some holes where MK is lacking (notably UI widgets). But they both do basic DOM, event handling, Ajax support, etc. Why try to use both? What's the real strategy here? Dojo is a solid framework developed by a very skilled group of people. Choosing MochiKit vs. Dojo is mostly a style decision, but MochiKit does have better documentation coverage so it may be easier to pick up. This mailing list is also a hell of a lot easier to keep up with than the Dojo list :) If you do need substantial features that are in Dojo that are not in MochiKit, and the rest of your needs are met by Dojo, then there's no good reason to use both. If you need features from both, then use both. I don't know what kind of answer you're hoping to get here... If you need some features from MochiKit that aren't in Dojo, then it shouldn't be too hard to extract that portion of MochiKit and port it to use Dojo's base functionality instead of depending on the rest of MochiKit. There's already been cross-pollination in that direction, and they'd probably take patches for more. MochiKit is license compatible, and I've signed a contributor agreement and everything so it shouldn't be a big deal. - All of the existing MK stuff looks really great, but what's the best strategy for including the widgets that everyone needs? Is that where pulling in parts of Dojo is the best strategy? What about YUI? From a purely widget point-of-view, YUI actually looks to be quite robust right now, and that their stuff is in use on yahoo.com inspires a lof of trust. Bob mentioned script.aculo.us issues, but I see you guys are porting it (undoubtedly fixing it at the same time). Is the intention for that to be the base of a true MK widget library in a future release? What's the best widget strategy for today? It seems more popular to use MochiKit and Yahoo UI together than MochiKit and Dojo, but both have definitely been done before. MochiKit 1.4 should be functionally equivalent to whatever is in the script.aculo.us stack at the time of release, but there's not much else to it. There's no plan to become the ultimate widget library, this is simply an effort by MochiKit developers to make it better suit their particular needs. MochiKit is effectively just a bunch of extracted code from real web applications, I really don't want to see it grow functionality that nobody is using. -bob -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: MochiKit Base in ActionScript
Not that I want to discourage you, or even suggest that MochiKit isn't the best tool available (which I think it is), but make sure you check out http://www.burrrn.com/projects/core2.html since it targets actionscript as much as plain ecmascript. Could be nice though to know that mochi would work in AS On 5/30/06, Theo [EMAIL PROTECTED] wrote: I've successfully ported parts of MochiKit Base to ActionScript 2, to make it suck less. There was a thread about this a while ago, but I wasn't allowed to reply to it: http://groups.google.com/group/mochikit/browse_thread/thread/a19228fe2f24233/88a78e3ef7fe4bfc?q=actionscriptrnum=1#88a78e3ef7fe4bfc I do a lot of Flashprogramming, and MochiKit helps me from going insane. I'm thinking of porting some of the Iter package and Deferred, too. It's not very hard, there are some compiler errors to weed out (not much of an issue in JS but the AS-compiler warns about it), and some cross references to MochiKit functions that must be referenced differently. yours, Theo# -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Using Mochikit with my Classes - Looking for Beginner Documentation
mochikit doesn't feature a class-emulation kit per se, as other frameworks does. personally i think this is a good thing. I use a variant of the technique described here: http://www.itsalleasy.com/2006/02/24/classjs-third-time-is-the-charm/ For some reading/discussion on the subject, I suggest you take a look at this post (in particular the comments) : http://www.sitepoint.com/blogs/2006/01/17/javascript-inheritance/ On 5/25/06, Will [EMAIL PROTECTED] wrote: Hi, I've been using Mochikit for some time to do simple stuff, but I am now trying to work it into my prototypes (small p)/classes, but the I am having some trouble with what this references, and it also seems like there are a whole bunch of tools to make building classes easier, but I am definitely lost. So I was wondering, rather than trouble you with some little example, maybe I can read up on suggested ways of building classes using Mochikit. Is there some documenation on this for mid-advance js writers? I'm looking for a good starting point. Thanks! -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: stopPropagation() and onclick
You need to call e.preventDefault() aswell. Or just use e.stop(); On 4/4/06, Melkor [EMAIL PROTECTED] wrote: I'm connecting anchors (a) with a signal that calls the event.stopPropagation() method. My intent is for the anchor not to be followed. Previously I had this code that worked: a href = # onclick = handler(this);return false;Text/a But now the link is being followed, making the anchor loose its focus. What I'm doing wrong? Thanks, Pablo -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---
[mochikit] Re: Disconnect All?
Very good idea - I remember looking for exactly that the other day.Useful for putting in the destructor/teardown of a controller-object (widget). For the sake of interoperability, I think it's better with a separate method, rather than extending the signature of disconnect. Better to stay close to the standard removeEventListener. disconnectAll(elem); or disconnectAll(elem, onmousedown); perhaps even disconnectAll(elem, onmousedown, onmouseup); or disconnectAll(elem, [onmousedown, onmouseup]); On 3/28/06, Beau Hartshorne [EMAIL PROTECTED] wrote: Should we provide a shortcut to disconnect all? Something like: disconnect(elem, 'onmousedown', '*'); or disconnect(elem, '*'); What should that look like? -- troels --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups MochiKit group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~--~~~~--~~--~--~---