mochi / mochikit Goto Github PK
View Code? Open in Web Editor NEWMochiKit makes JavaScript suck less
Home Page: http://mochi.github.io/mochikit
License: Other
MochiKit makes JavaScript suck less
Home Page: http://mochi.github.io/mochikit
License: Other
I think serializeJSON should recognize the toJSON() method by default now that it has been standardized, see JSON.stringify at http://www.json.org/json2.js.
MochiKit.Base.registerJSON("has_toJSON",
function(obj)
{
return typeof(obj.toJSON) == 'function';
},
function(obj)
{
return obj.toJSON();
}
);
Seems like the "checked" and "disabled" attributes need to be detected and set explicitly as elem.checked = true/false, not via setAttribute.
// Fredrik Blomqvist
Could be nice to add partial aliases for DOM.LINK, DOM.SCRIPT and DOM.IFRAME.
Hi,
This is a kind of RFC before going to PR.
In my fork I've now added a major under-the-hood update to MochiKit.Signal lib.
It uses WeakMap and Set to store references to signals to enable automatic GC.
Should also be faster due to less linear searches.
See: https://github.com/blq/mochikit/blob/master/MochiKit/Signal.js
All unit-tests pass except one, disconnectAllTo(function) since WeakMaps doesn't allow full iteration and I wanted to reduce WeakMaps to only source and dest objects, not functions.
Observe that this setup doesn't remove need to disconnect of course, WeakMaps only release fully GC:ed objects, it's not an out-of-your-scope release.
Another change in my fork is support for signal namespaces, similar to jQuery. That is a separate discussion I guess..
(WeakMap means IE10 is out, but code is written to still work in IE11 (no for-of loops or such))
If you go to the customized download page and create a distribution consisting just of a few sub-modules, the SUBMODULES variable still lists all modules.
This leads a couple of unnecessary http request.
Is it save to edit the SUBMODULES array?
Thanks
Florian
In recent versions of Chrome and Firefox the following code always calls errback
if 'whatever'
is a local resource
var xhr = getXMLHttpRequest();
xhr.open('GET', 'whatever');
xhr.responseType = 'arraybuffer';
sendXMLHttpRequest(xhr);
Here we need xhr.response
, not xhr.responseText
or xhr.responseXML
, but MochiKit.Async._xhr_onreadystatechange
fails if status
is 0 and responseText
is not set.
Reason remove GitHub API v2 at June 12, 2012
in file packd/MotiKit/customize.html
Windows Vista 64bit
python 2.7.2 (16bit)
run script/pack.py.
add control code on file end.
Just my environment?
script/pack.py
line:16
- outf = file(os.path.join(dirname, 'packed/MochiKit/MochiKit.js'), 'w')
+ outf = file(os.path.join(dirname, 'packed/MochiKit/MochiKit.js'), 'wb')
Thought I'd forward this old forum post by Imri Goldberg. I've used the suggested patch and it seems to work.
http://groups.google.com/group/mochikit/browse_thread/thread/fddacb62dd14deb8
Here is a firebug log to show the bug, present in mochikit 1.4.2, and
according to a test I did, also in mochikit 1.5:
list([1])
[1]
list(chain([1],[2]))
[1, 2]
list(chain([1],[2],[3]))
[1, 2, 3]
>>> list(chain([],[],[3]))
[]
list(chain([1],[2],[3]))
[1, 2, 3]
list(chain([],[2],[3]))
[2, 3]
>>> list(chain([],[],[3]))
[]
*>>> list(chain([],[],[1]))
[]
list(chain([1],[],[1]))
[1]
list(chain([1,2],[],[1]))
[1, 2]*
To fix the bug, I suggest changing lines 298-300 (in 1.4.2) of next (defined
in chain()) from:
argiter.shift();
var result = argiter[0].next();
return result;
to:
argiter.shift();
continue;
Cheers,
Imri
I noticed this, and I have no idea on how to open a pr.
If you add npm scripts, you can then run the build scripts
from the base directory without cd
ing to the scripts
folder.
This makes it easier, by letting you type npm run build
.
from http://trac.mochikit.com/ticket/352
Is the optional realISO parameter(to add leading zero or not) in toISOTime official? toISOTime(date, realISO/* = false */) If it is, it is currently not part of the DateTime? documentation.
Regards
// Fredrik Blomqvist
Could you upload the custom builder to the gh-pages branch? When clicking it, I'm sent to a dead appspot url.
The failing test is test_MochiKit-Style.html with this output:
Passed: 68
Failed: 7
not ok - default left table cell content h ok: got 34, expected 30
not ok - default middle table cell content h ok: got 34, expected 30
not ok - default right table cell content h ok: got 34, expected 30
not ok - collapsed left table cell content h ok: got 32, expected 30
not ok - collapsed middle table cell content h ok: got 32, expected 30
not ok - collapsed right table cell content h ok: got 32, expected 30
not ok - test suite failed in 00:00.024
Wish I can give more detail about the failing tests, but I thing if you use a new version of Firefox you will find them out.
@etrepum is it possible to look at this for you ?
from http://trac.mochikit.com/ticket/340
The example code at: http://mochikit.com/doc/html/MochiKit/Iter.html#fn-iter is not correct. The generic usage of iterable shouldn't stop on null values, only on StopIteration.
var it = iter(iterable);
try {
while (var o = it.next()) { // <-- !
// use o
}
} catch (e) {
if (e != StopIteration) {
throw e;
}
// pass
}
It should rather be:
var it = iter(iterable);
try {
while (true) { // <-- !
var o = it.next();
// use o
}
} catch (e) {
if (e != StopIteration) {
throw e;
}
// pass
}
Regards
// Fredrik Blomqvist
Tried to look at some demos on both mochikit.com and http://mochi.github.com/ but every demo i tried failed with Uncaught MochiKit.LoggingPane depends on MochiKit.Logging!
from http://trac.mochikit.com/ticket/344
In the documentation for Async.Deferred at http://mochikit.com/doc/html/MochiKit/Async.html#fn-deferred the three states of the Deferred (-1, 0, 1) are mentioned. But it is not quite clear how to obtain the state. the word "fired" is only mentioned in the running text. I think the property ".fired" should be clearly included in the formal specification/documentation for Deferred.
Also, http://mochikit.com/doc/html/MochiKit/Async.html#fn-genericerror mentions a non-existing "failed" method of the Deferred object, it should be removed.
Regards
// Fredrik Blomqvist
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.