[webcomponents] [Custom]: attachedCallback has no protocol for indicating that the custom tag is not applicable in this context (bugzilla: 27978) (#151)

Title: [Custom]: attachedCallback has no protocol for indicating that the custom tag is not applicable in this context (bugzilla: 27978)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27978

----
comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27978#c0
*Randy Harmon* wrote on 2015-02-07 19:15:55 +0000.

I want to be able to call out cases where a custom tag has been used in a context where it's just not applicable.  \<tr\> outside a \<table\> is a traditional HTML example of this scenario, but we don't seem to have any allowances for that scenario in the custom elements spec.

"attachedCallback
Unless specified otherwise, this callback must be enqueued whenever custom element is inserted into a document and this document has a browsing context.
"

I was thinking that the component author should be able to raise an exception from the attachedCallback to indicate that it's a wrong context for creating the element.  Not that we can't console.log() to let component-users know about the problem, but so that the user-agent can have the indication that the element is invalid, perhaps triggering a visual treatment for the tag in developer tools.

----

comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27978#c1
*Dominic Cooney* wrote on 2015-02-09 02:31:58 +0000.

The treatment of elements in developer tools aren't really specified in any W3C specifications as far as I know. For specific browsers you could file a bug, eg for Chrome at crbug.com/new .

I could be wrong, but I think in Chrome if attachedCallback throws an exception it will be logged to the console in Developer Tools. If not, file a bug at crbug!

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/151

Received on Monday, 6 July 2015 07:36:18 UTC