Pair of functionalities to String object. Actully i found that String.toElement method conflicts with Element.update or may be also with some other functions
Object.extend(String.prototype, { /** * If the string is html code and enclosed with html element convert to Element * else the string is wraped with <span> or with 1st argument tag * * return {Element} */ toElement: function() { str = this.strip(); if (!str.startsWith('<') || !str.endsWith('>')){ wrapTag = arguments[0]||'span'; str = '<' + wrapTag + '>' + str + '</' + wrapTag + '>'; } var node = new Element('span'); node.innerHTML = str; if (node.childElements().length == 1) { return node.down(); } return node; }, /** * Extract elements from HTML code with given selector * * @param {String} selector * @return {Array} Array of elements */ extractElements: function(selector) { return this.toElement().select(selector); } }) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---