Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7989 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Element#replace doesn't replace input fields in FF and Safari

Reported by: demian85 Assigned to: Tobie
Priority: normal Milestone: 1.x
Component: Prototype Version: edge
Severity: normal Keywords: 1.5.2
Cc:

Description

I was trying to replace an HTMLInputElement with a text node but it seems that the new node is inserted after the input and its attributes are gone!! Try this js code:

$('asddfg').replace('crazy text!');
// try it with <input type="text" id="asddfg" value="aaaaaaaa" />

The resultant html is this:

<input>crazy text!

Temporaly i had to insert the new node before or after the input and then remove the input.

Please fix it! Thanks!

Attachments

getting_replace_method_to_work_for_single_tags_like_input (1.9 kB) - added by dsl239 on 04/29/07 05:45:59.

Change History

04/11/07 21:55:25 changed by demian85

hi? news??

04/29/07 05:45:59 changed by dsl239

  • attachment getting_replace_method_to_work_for_single_tags_like_input added.

05/03/07 01:58:04 changed by Tobie

  • keywords set to 1.5.2.
  • owner changed from sam to Tobie.
  • summary changed from replace() method for some html elements does not work as expected to Element#replace doesn't replace input fields in FF and Safari.
  • severity changed from major to normal.
  • priority changed from high to normal.

05/12/07 05:02:00 changed by sam

  • status changed from new to closed.
  • resolution set to fixed.

(In [6725]) Merge -r6634:HEAD from ../branches/dom.

* Make Element#update and Element#insert work for SELECT tags in IE and Opera. [Tobie Langel]

* Make Element#insert and Element#update better handle TABLE related elements in IE and Opera. Closes #7776, #8040, #7550, #7776, #7938. [Tobie Langel]

* Make Element#readAttribute('title') work in Opera. [Tobie Langel]

* Make Element#replace work with form elements in Firefox and Safari. Closes #8010, #7989. [dsl239, Tobie Langel]

* Add Element#wrap which wraps the element inside a new one. Closes #5732. [P. Vande, Tobie Langel]

* Make Element into a constructor: new Element(tagName, attributes). Add Element#writeAttribute which accepts a hash of attributes or a name/value pair. Closes #7476. [Mislav Marohni?\196?\135, haraldmartin, Tobie Langel]

* Insertion overhaul: Add Element.insert(content[, position = 'Bottom']). Deprecate Insertion (kept for backwards compatibility). Make Ajax.Updater option.insertion accept both Insertion.Top or the now preferred 'Top'. Closes #7907. [Tobie Langel]