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

Ticket #7358 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

[PATCH] Fix specific element extensions (i.e., $(someField).serialize) in Safari

Reported by: savetheclocktower Assigned to: sam
Priority: high Milestone: 1.x
Component: Prototype Version:
Severity: major Keywords:
Cc:

Description

Based on Sam's and Thomas's recent discovery that, in Safari >= 2.0, document.createElement('div').__proto__ === document.createElement('form').__proto__ (i.e., all elements descend from the same prototype).

This patch checks for such behavior; if it's found, Element.extend handles these specific element extensions.

Element.addMethods has been refactored to optionally accept two arguments instead of one:

Element.addMethods("DIV", { foo: function(element) { alert("bar"); } });
Element.addMethods($w("LI DIV"), { bar: function(element) { alert("thud"); } });

The first argument can be a tag name or an array of tag names. If only one argument is passed, the methods are applied to all elements.

Attachments

extensions.diff (8.4 kB) - added by savetheclocktower on 01/24/07 19:26:13.
Patch (including unit tests)

Change History

01/24/07 19:26:13 changed by savetheclocktower

  • attachment extensions.diff added.

Patch (including unit tests)

01/27/07 19:45:35 changed by sam

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

(In [6048]) prototype: Fix $(form).serialize() in Safari and add support for extending specific tags to Element.addMethods. Closes #7358.