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

Fix typo in '2.1.1 Creating a custom tag' #446

Closed
wants to merge 1 commit into from
Closed

Fix typo in '2.1.1 Creating a custom tag' #446

wants to merge 1 commit into from

Conversation

rianby64
Copy link
Contributor

According to #431 the example given in the documentation should use document.registerElement instead of document.defineElement

@@ -176,7 +176,7 @@ <h4 id="custom-elements-custom-tag-example">Creating a custom tag</h4>
<p>We then need to use this class to define the element:</p>

<pre class="highlight">
document.defineElement("flag-icon", FlagIcon);</pre>
document.registerElement("flag-icon", FlagIcon);</pre>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't right. We should be using window.customElements.define instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. But if you check window.customElements in browser then it isn't define yet. But, document.registerElement at least is present in Firefox and Chrome. For the shake of the example let's consider use registerElement. After all by using registerElement the example will work in some way.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example should reflect the specification, not the current implementations in browsers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right! This interface 2.4 The CustomElementsRegistry interface should be used.

Anyway. Will be great if other developers will read an example that works. The introduction section is non-normative after all. So, today we can read an example that works and allows us to understand the meaning of custom components.

@domenic domenic closed this in d0f7fec Mar 17, 2016
@domenic
Copy link
Collaborator

domenic commented Mar 17, 2016

Thanks @rianby64! Updated in d0f7fec to use the correct customElements.define API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants