4 ms·
Having a quick read of the documentation, Ext Core 3.0 is very similar to jQuery, except no-one uses it, its syntax is uglier (i.e. the distinction between Ext.
by halo 18y ago
Having a quick read of the documentation, Ext Core 3.0 is very similar to jQuery, except no-one uses it, its syntax is uglier (i.e. the distinction between Ext.get vs Ext.fly is problematic, the weird inclusion and naming of Ext.radioClass for something you can do in 2 lines of code), it adds a hodgepodge of dubious "object oriented" features, and randomly extends a few built-in objects via prototypes (or 'JavaScript Augmentation') something which is generally considered a bad idea.
The idea that people should choose this above jQuery because one day they may shell out the money on a proprietary JavaScript library is crazy, especially as so few people on the web are doing RIA stuff to begin with. There's simply no reason to use it unless you're relying on ExtJS anyway, especially as most web developers already knows and uses the simple jQuery syntax.
- amix 18y agoI have looked the implementation* of Ext.fly and I still don't understand why it's smart or faster than using document.getElementById. Somebody care to explain? * http://pastie.org/437448 http://pastie.org/437448
- deleted 18y ago[deleted]
- TommyM 18y agoEdit: Oh, I see you removed your post ;) I'll leave my reply on here anyway for people interested in what the Ext.select element does. Actually you can't use CSS selectors with the Ext.fly method. I think you are confused with the Ext.select method, which returns a CompositeElementLite instance containing an array of all elements conforming to the specified CSS selector. It lets you perform operations on a collection of elements as if you are using a single element. This is very close to what the jQuery $('.some-selector') provides you and works by iterating over the elements array and swapping the DOMElement pointer on an internal Flyweight instance right before it executes the operation on that Flyweight, and thus performing the operation on each element.
- deleted 18y ago[deleted]
- TommyM 18y agoExt.fly uses the Flyweight pattern, which basically means that instead of creating a new instance of Ext.Element to wrap around the DOM element, it uses one global instance of Ext.Element and just simple replaces the internal pointer to the DOM element within that instance. This makes it faster because it can skip constructor and additional logic to create the Ext.Element instance, and smart because it doesnt need additional memory for a new instance. To read more about the Flyweight pattern, you can read here: http://en.wikipedia.org/wiki/Flyweight_pattern http://en.wikipedia.org/wiki/Flyweight_pattern
- DougBTX 18y ago> or faster than using document.getElementById The bit to explain is that Ext.fly (and jQuery() for that matter) don't return actual DOM elements like document.getElementById does. Instead they return a Javascript object which you can use to interact with the DOM element(s) using a different API. Both are probably slower than document.getElementById, but allow you to program at a higher level of abstraction. For example, jQuery(".foo").someMethod() could act on many DOM elements, but document.getElementById().someMethod() can only act on one.