#20 ✓invalid
John-David Dalton

Fix or deprecate != attribute selector

Reported by John-David Dalton | April 16th, 2008 @ 06:41 PM | in 1.7

I tried this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stric...">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<script type="text/javascript" src="prototype.js"></script>
  Event.observe(window, 'load', function(){
    //Example "A"
	alert($$('*[id!=""]').length);    //IE: 2 (offset by the IE only "dom:loaded" script insert), Firefox: 1, Safari 3.1: 1
	//Example "B"
	alert($$('*[id!="foo"]').length); //IE: 10 (All Elements on the page), Firefox: 1, Safari 3.1: 1
	//Example "C"
	alert($$(':not(div)').length);    //IE: 8 (offset by the script element), Firefox: 7, Safari 3.1: 7	
	//Example "D"
	alert($$('*[tagName!="DIV"]').length); //IE: 8 (offset by the script element), Firefox: 0, Safari 3.1: 0

<div id="test">Hi</div>
<a href="#">word</a>


Forget the inconsistency of elements based on the dom:loaded IE script insert. This ticket is not about that. I don't see that as a big deal and if we move away from that in favor of a more stable solution (see http://dev.rubyonrails.org/ticke...) it won't be an issue.

Look at Example "B" and Example "D" that is where the problem is. This is because Firfox/Safari use XPath/Selector API while IE uses the DOM only. We should probably conform these somehow.

I Had to test the negative selector in IE with Prototype (not the recent git version because it fails some unit tests). I did use the the stable and the git versions to test Firefox/Safari 3 because it bypasses the issue via its XPath/selector API.

This issue may be resolved in the recent git, but because it errors out I cannot test it.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket

Referenced by