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

" _updateRendering() { // Left as an exerci..." #3029

Closed
o-t-w opened this issue Sep 10, 2017 · 4 comments
Closed

" _updateRendering() { // Left as an exerci..." #3029

o-t-w opened this issue Sep 10, 2017 · 4 comments
Labels
clarification Standard could be clearer topic: custom elements Relates to custom elements (as defined in DOM and HTML)

Comments

@o-t-w
Copy link

o-t-w commented Sep 10, 2017

https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-autonomous-example

_updateRendering() {
// Left as an exercise for the reader. But, you'll probably want to
// check this.ownerDocument.defaultView to see if we've been
// inserted into a document with a browsing context, and avoid
// doing any work if not.
}

I don't think a spec is the best place for a pop-quiz. It would be nice to see a fleshed out example for people trying to get there heads around custom elements.

@domenic
Copy link
Member

domenic commented Sep 10, 2017

Well, the point of this example isn't to show how to render a country flag. It's to show how custom elements work. So I'd rather not distract from the point by spending a bunch of space on country flag rendering.

@o-t-w
Copy link
Author

o-t-w commented Sep 11, 2017

Yes, that's fair enough. Would you be kind enough to educate me on what a document without a browsing context would be? I know this is meant as a spec for implementers and not a tutorial...but there aren't many decent resources on vanilla custom elements right now so I'm trying to learn.

@domenic
Copy link
Member

domenic commented Sep 11, 2017

document.implementation.createDocument()

@domenic domenic added clarification Standard could be clearer topic: custom elements Relates to custom elements (as defined in DOM and HTML) labels Sep 14, 2017
@domenic domenic closed this as completed Oct 13, 2017
@OnkarRuikar
Copy link

To save googling time, here is the completed example https://stackoverflow.com/a/69602658/15273968

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer topic: custom elements Relates to custom elements (as defined in DOM and HTML)
Development

No branches or pull requests

3 participants