Live data from Hacker News

ƒu.js - The Functional DOM traversing library.

tsenart.github.com

1–10 of 47 posts

Re: ƒu.js - The Functional DOM traversing library.

#3
post #2

I like one-file less-than-100-LOC type libs.

It's not really meant for general purpose. Just for projects where you want raw javascript performance and need a little help for traversing and manipulation of DOM elements as arrays. Like my Chrome extension: Sight: https://github.com/tsenart/sight.

Re: ƒu.js - The Functional DOM traversing library.

#4
Am I missing something here or do I really have to type the weird curly-F every time I want to call this? Having charmap open in my taskbar is not my idea of being productive. Plus, from my cursory glance this looks pretty similar, if not almost identical, to jQuery...

Re: ƒu.js - The Functional DOM traversing library.

#5
post #4

Am I missing something here or do I really have to type the weird curly-F every time I want to call this? Having charmap open in my taskbar is not my idea of being productive. Plus, from my cursory glance this looks pretty similar, if not almost identical, to jQuery...

It is nothing like jQuery. It's a small utility library for easing your life when dealing with raw javascript. You can use ƒ or fu.

Re: ƒu.js - The Functional DOM traversing library.

#10
Why would you use this over normal querySelector{All}? Also, why do you define a window.typeOf global? It completely defeats the purpose of using a clousure.

You also seem to be checking `typeof value.length == 'number' && typeof value.splice != 'undefined' && !value.propertyIsEnumerable('length')` to determine if something is an Array. First of all, the recommended practice is to check Object.prototype.toString.call(value) === "[object Array]", but since you're going to rely on latest browsers supporting querySelector{All}, you might as well use Array.isArray.

I'm sorry for being so harsh, but this is the most worthless library I have ever seen. You're adding an extremely thin and pointless layer of abstraction to querySelectorAll and polluting the global namespace with four globals, three of which are completely identitcal, and two of which take too much effort to type. Not to mention your use of worst practices (such as using eval(), only loose comparisons, wrapping all of your code in try..catch statements instead of just not doing things that will throw errors, etc.) and your prototypical pollution in Array, Document, and Element. For example, you define Array.prototype.flatten for internal use. You shouldn't pollute global prototypes for something that you can do privately.

Post reply on HN