W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Re: [DOM4] Remove Node.isSameNode

From: Charles Pritchard <chuck@jumis.com>
Date: Fri, 09 Sep 2011 20:05:24 -0700
Message-ID: <4E6AD3F4.5000109@jumis.com>
To: Jonas Sicking <jonas@sicking.cc>
CC: Sean Hogan <shogun70@westnet.com.au>, Webapps WG <public-webapps@w3.org>
On 9/9/2011 6:02 PM, Jonas Sicking wrote:
> On Fri, Sep 9, 2011 at 3:42 PM, Charles Pritchard<chuck@jumis.com>  wrote:
>> On Sep 9, 2011, at 2:27 PM, Sean Hogan<shogun70@westnet.com.au>  wrote:
>>> On 10/09/11 3:21 AM, Jonas Sicking wrote:
>>>> It's a completely useless function. It just implements the equality
>>>> operator. I believe most languages have a equality operator already.
>>>> Except Brainfuck [1]. But the DOM isn't implementable in Brainfuck
>>>> anyway as it doesn't have objects, so I'm ok with that.
>>>> [1] http://en.wikipedia.org/wiki/Brainfuck
>>> If a DOM implementation returns  node-wrappers instead of exposing the actual nodes then you could end up with different node-refs for the same node. I'm not sure whether that violates other requirements of the spec.
>> A similar method is present in the JS libs too, like jQuery. If it is necessary, is a Node.isSameType useful?
> I take it you mean "isSameNode", right?
> Do you have a pointer to the jQuery function?
> / Jonas

For jQuery, I think the is() method is the one; it's used for various 
things, but $(element).is($(element)) returns true, I believe.
Typically that parameter is going to be selector, or an already existing 
variable, resulting from perhaps another selector.


I meant isSameType: as a shortcut to comparing nodeType and Element 
local name.

I'm not a fan of the  if(element instanceof HTMLParagraphElement) style.
This is just some sugar.

isSameType (in the same style of isEqualNode):
The isSameType(node) method must return true if all of the following 
conditions are true, and false otherwise:
* node is not null.
* node's nodeType attribute value is the same as the context object's 
nodeType attribute value.

The following are also equal, depending on node:

     Its name, public ID, and system ID.

     Its namespace, namespace prefix, local name.

Received on Saturday, 10 September 2011 03:05:48 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:34 UTC