I'm writing an app which retrieves an RSS feed and processes it. I'd like to use the Prototype methods on it, but first it must be extended. The documentation says:
extend extend(element) Extends element with all of the methods contained in Element.Methods and Element.Methods.Simulated.... which is not much help in extending an element _not_ in the global document tree. The page http://prototypejs.org/learn/extensions gives the example: var my_div = document.createElement('div'); Element.extend(my_div); my_div.addClassName('pending').hide(); so I wrote the following code to try and test this: function doProcess(response) { // this is the onSuccess method of an Ajax.Request try { window.console.log("document.select: " + document.select); // returns undefined var docext = Element.extend(document); window.console.log("docext.select: " + docext.select); // returns undefined var ext = Element.extend(response.responseXML); window.console.log(ext); window.console.log("ext.select: " + ext.select); // returns undefined window.console.log(ext.select("item")); // throws a TypeError window.console.log("num items " + items.length); for (i=0; i<items.length; ++i) { window.console.log(items[i].nodeName); } } catch (error) { window.console.log(error); } } so, how do I actually extend documents and elements that are not part of the global documents tree? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
