W3C home > Mailing lists > Public > public-webapi@w3.org > January 2007

Re: Selectors API naming

From: Hallvord R. M. Steen <hallvord@opera.com>
Date: Mon, 29 Jan 2007 15:40:42 +0100
To: "Maciej Stachowiak" <mjs@apple.com>, "Charles McCathieNevile" <chaals@opera.com>
Cc: "Anne van Kesteren" <annevk@opera.com>, "Web API WG (public)" <public-webapi@w3.org>
Message-ID: <op.tmw614e5a3v5gv@hr-opera.upc.no>

On Mon, 29 Jan 2007 06:54:04 +0100, Maciej Stachowiak <mjs@apple.com>  
wrote:

> * - This seems unlikely in any case since they are Document methods; and  
> surely things like getAttribute and setAttribute exist in non-DOM code,  
> but thanks to the magic of object oriented programming and the fact that  
> such names are class-scoped this is not a big problem

Maybe not a big problem but it is still a problem because of the wonderful  
"with" statement. I remember a BT.com CC number validation script break  
because they did

with(document.forms[0]){
	prefix='foo'; // clashes with element.prefix
}

and yesterday or so the same issue prevented form submission in Opera on a  
site where someone did

with(input){
	var pattern='foo'; // clashes with WebForms2 input.pattern
}

It would be nice to have the get() / getBySelector() method on Node as  
well (like getElementsByTagName is) and then I'm absolutely sure we'll run  
into pages that say

<script>function getAll(){ ... }</script>
<body onload="getAll() /* um, you meant YOUR function and not  
body.getAll()? sorry, you're dead. */">

So a longer and more descriptive name and less web evangelism and patching  
efforts :-)

-- 
Hallvord R. M. Steen
Core QA JavaScript tester, Opera Software
http://www.opera.com/
Opera - simply the best Internet experience
Received on Monday, 29 January 2007 14:40:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:56 GMT