Re:ƒu.js - The Functional DOM traversing library.
by jeresig on Sunday January 30, 2011 @09:35AM
(#2158106)
Some quickie improvements to the jQuery examples:
can become:
and:
can become:
(We optimize for body explicitly in our selector code.) Although that last example selector is rather weird, it's equivalent to:
or even just:
(When is a ul ever going to be outside of a body element?)
[ Parent
| on HN ]
Re:ƒu.js - The Functional DOM traversing library.
by Sephr on Sunday January 30, 2011 @11:18AM
(#2158314)
document.body.ƒ('ul li:last-child').innerText = "I'M THE NEW GUY!";
That code won't work in standards-compliant browsers. You should either use .textContent = "..." or .appendChild(document.createTextNode("...")) or .firstChild.wholeText = "..." if there's already a text node child.The real issue though is that unlike jQuery, ƒu.js won't work in popular versions of IE.
Re:ƒu.js - The Functional DOM traversing library.
by masklinn on Sunday January 30, 2011 @11:42AM
(#2158376)
Well apart from the first one (clearly my mistake) I was trying to translate the original semantics as closely as possible. Hence the repeated (if not very useful) `body` anchors.
> (When is a ul ever going to be outside of a body element?)
Document fragments? XML documents? Not sure you can use that style of jQuery calls on those, but~~