This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15792 - [Shadow]: cloneNode should throw DATA_CLONE_ERR
Summary: [Shadow]: cloneNode should throw DATA_CLONE_ERR
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14978
  Show dependency treegraph
 
Reported: 2012-01-30 12:15 UTC by Hayato Ito
Modified: 2012-01-31 23:30 UTC (History)
0 users

See Also:


Attachments

Description Hayato Ito 2012-01-30 12:15:20 UTC
The latest draft spec says:
  Invoking the cloneNode() method on a ShadowRoot instance must always throw a HIERARCHY_REQUEST_ERR exception.

But according to Node's IDL definition,
  http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247
 Node               cloneNode(in boolean deep);

It seems cloneNode must not throw DOMException.
Is it okay to throw DOMException in case of ShadowRoot?
Comment 1 Dimitri Glazkov 2012-01-30 17:30:44 UTC
Sure, why not? If you'd like, I can redefine cloneNode on ShadowRoot in the IDL?
Comment 2 Hayato Ito 2012-01-30 23:32:05 UTC
If that's okay and commonly used in IDL world, I do not mind. :)
I just afraid that it seems to violate substitution principle of inheritance in general.

Fo example, if DOMException should be considered a 'checked' exception (I borrowed the word from Java) , it violates substitution principal. Subclass can not override a method so that it add a checked Exception which is not declared in superclass's signature.

In IDL world, I am not sure whether we should keep this rule or not. I just want to make sure that is okay in IDL.

(In reply to comment #1)
> Sure, why not? If you'd like, I can redefine cloneNode on ShadowRoot in the
> IDL?
Comment 3 Dimitri Glazkov 2012-01-30 23:42:34 UTC
The thing is that cloneNode _does_ indeed throw an exception  for DocumentFragments: http://www.w3.org/TR/2011/WD-domcore-20110531/#clone

I think the IDL is just wrong. I'll file a bug against domcore.
Comment 4 Hayato Ito 2012-01-31 04:55:53 UTC
Thank you.
I agree that either the spec or the implementation must be fixed if DocumentFragment's cloneNode might throw DOMException. I cannot find any spec that DocumentFragment's cloneNode may throw DOMException.

(In reply to comment #3)
> The thing is that cloneNode _does_ indeed throw an exception  for
> DocumentFragments: http://www.w3.org/TR/2011/WD-domcore-20110531/#clone
> 
> I think the IDL is just wrong. I'll file a bug against domcore.
Comment 5 Dimitri Glazkov 2012-01-31 23:27:47 UTC
Renaming the bug to keep in sync with DOM Core.
Comment 6 Dimitri Glazkov 2012-01-31 23:30:37 UTC
http://dvcs.w3.org/hg/webcomponents/rev/75b4cc4d3efa