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

Ticket #5170 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] IE6 compatibility and enhancements to attribute selectors

Reported by: glazedginger@gmail.com Assigned to: sam@conio.net
Priority: normal Milestone: 1.x
Component: Prototype Version: 1.1.1
Severity: normal Keywords: $$ selector attribute
Cc: devslashnull@gmail.com

Description

- Adds full IE6 compatibility to attribute selectors.

- Adds ^=, $= and *= operators and replaces != (not in spec) by :not(X) which is applicable to all opperators:

 $$('form#foo input:not([type=text])').each(function(input) {
  Element.setStyle(input, {color: 'red'});
});

- Tested in Firefox, Safari & Internet Explorer 6.

- Detailed tests provided.

Attachments

selectors.diff (12.9 kB) - added by glazedginger@gmail.com on 05/23/06 18:26:43.
selectors.2.diff (13.3 kB) - added by glazedginger@gmail.com on 05/25/06 10:32:13.
Corrects a bug in $$() function which threw an error on attribute values containing whitespace (such as title="this is a nice link")
selectors.3.diff (13.4 kB) - added by glazedginger@gmail.com on 05/25/06 11:09:42.
cleaning up.
selectors.4.diff (13.9 kB) - added by glazedginger@gmail.com on 05/26/06 14:39:23.
corrects a bug with *=, = and $= (wasn't checking for existence, now is).
ie_attr.patch (6.1 kB) - added by savetheclocktower on 01/11/07 21:41:56.
Fixes for the bugs (IE attributes, spaces in attribute values).
attribute.diff (8.3 kB) - added by Tobie on 01/16/07 01:12:28.

Change History

05/23/06 18:26:43 changed by glazedginger@gmail.com

  • attachment selectors.diff added.

05/25/06 10:32:13 changed by glazedginger@gmail.com

  • attachment selectors.2.diff added.

Corrects a bug in $$() function which threw an error on attribute values containing whitespace (such as title="this is a nice link")

05/25/06 11:09:42 changed by glazedginger@gmail.com

  • attachment selectors.3.diff added.

cleaning up.

05/26/06 07:53:43 changed by devslashnull@gmail.com

  • cc set to devslashnull@gmail.com.

Good work! I'm glad someone took the time to correct the problems with my implementation.

05/26/06 14:39:23 changed by glazedginger@gmail.com

  • attachment selectors.4.diff added.

corrects a bug with *=, = and $= (wasn't checking for existence, now is).

05/26/06 14:58:25 changed by glazedginger@gmail.com

Brian,

Thanks for the heads up!

I've checked out Simon Willison's getElementsBySelector() while browsing your Behavior patch for Prototype (what's up with it BTW?) and found out that his implementation of *=, ^= and $= is quite different from mine.

From what I've roughly checked using Jason Orendorff's JavaScript speed test the speed difference seems minimal, but I don't really have the time to study this in more depth.

What do you suggest ?

Regards,

Tobie

01/11/07 21:41:56 changed by savetheclocktower

  • attachment ie_attr.patch added.

Fixes for the bugs (IE attributes, spaces in attribute values).

01/12/07 02:33:01 changed by savetheclocktower

The attachment fixes the bugs (attributes in IE, attribute values with spaces) described in this ticket. All of the unit tests pass, so there are no more blockers for 1.5.

The extra operators (and "not:") can wait until 1.5.1.

01/16/07 01:12:28 changed by Tobie

  • attachment attribute.diff added.

01/16/07 01:36:55 changed by sam

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

(In [5957]) prototype: Fix attribute selectors for IE. Closes #5170.