Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure the parser delivers exceptions during element creation to "report an exception" #151

Closed
hayatoito opened this issue Jul 6, 2015 · 0 comments

Comments

@hayatoito
Copy link
Contributor

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. outside a

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!

@domenic domenic changed the title [Custom]: attachedCallback has no protocol for indicating that the custom tag is not applicable in this context (bugzilla: 27978) Make sure the parser delivers exceptions during element creation to "report an exception" Mar 8, 2016
@domenic domenic added the v1 label Mar 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants