From 9b0bb24fe01c83086724c89d0b884a74f4f5088d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 27 Jun 2005 09:24:18 +0000 Subject: Update script.aculo.us scripts for Prototype 1.3.0 #1522 [Thomas Fuchs] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1536 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/action_view/helpers/javascripts/controls.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_view/helpers/javascripts/controls.js') diff --git a/actionpack/lib/action_view/helpers/javascripts/controls.js b/actionpack/lib/action_view/helpers/javascripts/controls.js index 4da9b52bc7..712784ee6d 100644 --- a/actionpack/lib/action_view/helpers/javascripts/controls.js +++ b/actionpack/lib/action_view/helpers/javascripts/controls.js @@ -19,6 +19,24 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Element.collectTextNodesIgnoreClass = function(element, ignoreclass) { + var children = $(element).childNodes; + var text = ""; + var classtest = new RegExp("^([^ ]+ )*" + ignoreclass+ "( [^ ]+)*$","i"); + + for (var i = 0; i < children.length; i++) { + if(children[i].nodeType==3) { + text+=children[i].nodeValue; + } else { + if((!children[i].className.match(classtest)) && children[i].hasChildNodes()) + text += Element.collectTextNodesIgnoreClass(children[i], ignoreclass); + } + } + + return text; +} + Ajax.Autocompleter = Class.create(); Ajax.Autocompleter.prototype = (new Ajax.Base()).extend({ initialize: function(element, update, url, options) { @@ -214,7 +232,7 @@ Ajax.Autocompleter.prototype = (new Ajax.Base()).extend({ select_entry: function() { this.hide(); this.active = false; - value = Text.decodeHTML(Element.collectTextNodesIgnoreClass(this.get_current_entry(), 'informal')); + value = Element.collectTextNodesIgnoreClass(this.get_current_entry(), 'informal').unescapeHTML(); this.element.value = value; this.element.focus(); } -- cgit v1.2.3