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

Editorial: Add CustomElementRegistry platform support #623

Merged
merged 10 commits into from
Dec 3, 2017
Merged

Editorial: Add CustomElementRegistry platform support #623

merged 10 commits into from
Dec 3, 2017

Conversation

snuggs
Copy link
Contributor

@snuggs snuggs commented Nov 11, 2017

  • √ CustomElementRegistry` Basic support
  • √ CustomElementRegistry.define()` support
  • √ CustomElementRegistry.get()` get
  • √ CustomElementRegistry.whenDefined()` whenDefined

Addresses:
- WICG/webcomponents#664

Related MDN Documentation:
- CustomElementRegistry.define() - https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define
- CustomElementRegistry.get() - https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/get
- CustomElementRegistry.whenDefined() - https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/whenDefined

References:
- Can I Use - https://caniuse.com/#feat=custom-elementsv1
- Chrome Status - http://www.chromestatus.com/feature/4696261944934400
- Firefox Status - https://platform-status.mozilla.org/#custom-elements
- Webkit Status - http://webkit.org/status.html#feature-custom-elements
- Edge Status - http://status.modern.ie/customelements

Notes:
- Firefox flag status - https://bugzilla.mozilla.org/show_bug.cgi?id=889230#c9

@snuggs
Copy link
Contributor Author

snuggs commented Nov 11, 2017

If this looks like i'm going in the right direction I can implement the following nested methods:

  • √ CustomElementRegistry.define()` support
  • √ CustomElementRegistry.get()` get
  • √ CustomElementRegistry.whenDefined()` whenDefined

Also noticed broken build.

Please advise

  - [x] √ CustomElementRegistry` Basic support
  - [ ] √ CustomElementRegistry.define()` support
  - [ ] √ CustomElementRegistry.get()` get
  - [ ] √ CustomElementRegistry.whenDefined()` whenDefined

  Addresses:
    - WICG/webcomponents#664

  Related MDN Documentation:
    - `CustomElementRegistry.define()` - https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define
    - `CustomElementRegistry.get()` - https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/get
    - `CustomElementRegistry.whenDefined()` - https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/whenDefined

  References:
    - https://caniuse.com/#feat=custom-elementsv1
    - Chrome Status - http://www.chromestatus.com/feature/4696261944934400
    - Firefox Status - https://platform-status.mozilla.org/#custom-elements
    - Webkit Status - http://webkit.org/status.html#feature-custom-elements
    - Edge Status - http://status.modern.ie/customelements

  Notes:
    - Firefox flag status - https://bugzilla.mozilla.org/show_bug.cgi?id=889230#c9
Copy link
Contributor

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

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

It is overall quite good. Most of the comments are the usual suspects when doing it for the first time.

"support": {
"chrome": {
"version_added": "33",
"notes": "Chrome 36+/Opera 20+ implemented a previous version of Custom Elements (v0) that used `.registerElement()`"
Copy link
Contributor

Choose a reason for hiding this comment

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

Opera 20+ has nothing to do here, it is an entry about Chrome.
Chrome 36+ is unclear, we write it clear "From Chrome 36, …" (formulation can be done a bit differently).

Also it looks like the note is a restriction/limitation that has been added after the initial release (33). Are you sure of this?

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 a bit confusing going back and forth between caniuse. I feel there are some misleading statements. Perhaps need to address there. Looks like 54 is v1 true version.

Fixed in 85a11a3

"version_added": "41",
"notes": "Supports 'Autonomous custom elements' but not 'Customized built-in elements'"
},

Copy link
Contributor

Choose a reason for hiding this comment

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

No empty line please

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in: c9714c4

"notes": "Supports 'Autonomous custom elements' but not 'Customized built-in elements'"
},


Copy link
Contributor

Choose a reason for hiding this comment

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

No empty line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in: c9714c4

},


"chrome_android": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please put entries in this order:
webview_android, chrome, chrome_android, edge, edge_mobile, firefox, firefox_android, ie, ie_mobile, opera, opera_android, safari, safari_ios.

Thank you.

Copy link
Contributor Author

@snuggs snuggs Nov 12, 2017

Choose a reason for hiding this comment

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

Hmmm out of curiosity why webview first @teoli2003? Also firefox_android has no specs as far as caniuse goes. For future reference do we totally remove or put null?

Fixed in: f17a21a

Also took the liberty to update documentation #625 as per your recommendation.


"chrome_android": {
"version_added": "61",
"notes": "Supports 'Autonomous custom elements' but not 'Customized built-in elements'"
Copy link
Contributor

Choose a reason for hiding this comment

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

At first look, I think customized built-in elements should be a subfeature here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@teoli2003 not sure I follow. I merely used GainNode as a reference point so not sure I know how to do this as this was not in there. Any examples?

},
"safari": {
"version_added": "10.1",
"notes": "Supports 'Autonomous custom elements' but not 'Customized built-in elements'"
Copy link
Contributor

Choose a reason for hiding this comment

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

At first look, I think customized built-in elements should be a subfeature here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@teoli2003 are we certain? Because the implementors (vendors) have no immediate plan to support this (with the exception of Chrome).

Please advise and I will update accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@teoli2003 also would .define(), .get(), & .whenDefined() be considered "Sub-Features"?

"CustomElementRegistry": {
"__compat": {
"mdn_url": "https://developer.mozilla.org/docs/Web/API/CustomElementRegistry",
"description": "The CustomElementRegistry interface provides methods for registering custom elements and querying registered elements.",
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually don't add a description at the interface level (it is more for subfeature that are neither interfaces, methods nor properties.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 5953258

"support": {
"chrome": {
"version_added": "33",
"notes": "Chrome 36+/Opera 20+ implemented a previous version of Custom Elements (v0) that used `.registerElement()`"
Copy link
Contributor

Choose a reason for hiding this comment

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

"chrome_android" has an additional restriction note, as well as safari. Doesn't it apply to "chrome" too? (And Opera): if so, they have to be added to each fo them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@teoli2003 how do we do multiple notes...an array? Perhaps i need to RTFM more hehe. ;-)

Fixed in: f8186a5

"version_added": false
},
"opera_android": {
"version_added": false
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure Opera restrict this to the desktop version?

Copy link
Contributor Author

@snuggs snuggs Nov 12, 2017

Choose a reason for hiding this comment

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

yup @teoli2003

Fixed in: b734b34

capture d ecran 2017-11-12 a 13 37 09

@snuggs
Copy link
Contributor Author

snuggs commented Nov 12, 2017

@teoli2003 addressed all of your concerns. Besides a couple of nits this patch should be more to your liking.

@snuggs
Copy link
Contributor Author

snuggs commented Nov 12, 2017

@teoli2003 just came across flags section. Seemed a little vague after reading this. Not certain if this is what you are looking for re: firefox flag. a140245

Copy link
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

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

Just one nit and I think this should be good.

},
"firefox": {
"version_added": true,
"notes": "Enabled through the `dom.webcomponents.enabled` preference in `about:config`",
Copy link
Member

Choose a reason for hiding this comment

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

This note is not needed, the MDN compat tables generate a consistent note from the flag object which we can also localize in the future. Please remove.

Copy link
Member

Choose a reason for hiding this comment

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

fyi, the generated note will be:

"This feature is behind the dom.webcomponents.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Elchi3 pardon my inexperience this schema is super confusing at least to me. Why would that not be a note of the flags section?

Copy link
Contributor

Choose a reason for hiding this comment

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

The flag section contains all the information about the pref to enable. There is no need to write the note explicitely. From the flag section information, macros can generate the note synthetically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see. Great explanation @teoli2003.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@teoli2003 Fixed in @teoli2003 Fixed in 0b27628

Copy link
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

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

Thanks!

@snuggs
Copy link
Contributor Author

snuggs commented Nov 27, 2017

@teoli2003 @Elchi3 next steps? Should we merge this or shall I complete .whenDefined .get and .define ? They are rather simple implementations from compat data.

Please advise...

@teoli2003
Copy link
Contributor

@snuggs I propose that you complete the three missing and we do a final review before merging all of them. The next package published will be next Monday, so we don't need to rush here.

@snuggs
Copy link
Contributor Author

snuggs commented Nov 28, 2017

Fantastic @teoli2003. Also is there a quick briefing how these get moved over to MDN? I started noticing updates to COMPAT tables recently but can't seem to find a tutorial on the code references when editing MDN docs. Any help would be appreciated.

@Elchi3
Copy link
Member

Elchi3 commented Nov 28, 2017

There is an MDN help page available about this: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Structures/Compatibility_tables

@Elchi3 Elchi3 added the data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Nov 28, 2017
@Elchi3
Copy link
Member

Elchi3 commented Dec 1, 2017

I think we should merge this. We're planning to slightly change the schema for the flag property and this PR would be affected / would need a rebase afterwards. To avoid that, this chunk could get merged now, and when you're ready to add more, we might already have the updated schema. What do you think @teoli2003?

Copy link
Contributor

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

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

lGTM, r+.

Thanks a lot!

@teoli2003 teoli2003 merged commit a06278e into mdn:master Dec 3, 2017
@teoli2003
Copy link
Contributor

Yes, yolu are right. Let's merge this.

@snuggs
Copy link
Contributor Author

snuggs commented Dec 4, 2017

Awesome! Feels great! Looking forward to more @teoli2003

@snuggs snuggs deleted the custom-element-registry branch January 11, 2018 06:04
@snuggs
Copy link
Contributor Author

snuggs commented Jan 11, 2018

@teoli2003 @Elchi3 just realized I need to complete the following APIs:

  • CustomElementRegistry Basic support
  • CustomElementRegistry.define()
  • CustomElementRegistry.get()
  • CustomElementRegistry.whenDefined()

How are we doing on the new schema update? I figured if given some time over holidays things would be a little more stable. Please advise on how I can wrap this up. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants