René's URL Explorer Experiment


Title: Discussion for possible `@angular/elements` public API changes · Issue #21585 · angular/angular · GitHub

Open Graph Title: Discussion for possible `@angular/elements` public API changes · Issue #21585 · angular/angular

X Title: Discussion for possible `@angular/elements` public API changes · Issue #21585 · angular/angular

Description: Possible @angular/elements public API (breaking) changes for discussion: Rename NgElementConstructor.is to NgElementConstructor.name. Background / Previous discussion Originally, we called this `selector`. @robwormald suggested renaming ...

Open Graph Description: Possible @angular/elements public API (breaking) changes for discussion: Rename NgElementConstructor.is to NgElementConstructor.name. Background / Previous discussion Originally, we called this `se...

X Description: Possible @angular/elements public API (breaking) changes for discussion: Rename NgElementConstructor.is to NgElementConstructor.name. Background / Previous discussion Originally, we called this `se...

Opengraph URL: https://github.com/angular/angular/issues/21585

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Discussion for possible `@angular/elements` public API changes","articleBody":"Possible `@angular/elements` public API (breaking) changes for discussion:\r\n\r\n- [ ] Rename `NgElementConstructor.is` to `NgElementConstructor.name`.\r\n  \u003cdetails>\r\n    \u003csummary>Background / Previous discussion\u003c/summary>\r\n    Originally, we called this `selector`. @robwormald suggested renaming to `is` to match what Polymer does. `is` is special according to the spec when defining \"customized built-in elements\" (which we currently do not support, but might support in the future).\r\n\r\n    @IgorMinar said:\r\n    Shouldn't this be called `element-name`? You can't use other kind of selector anyway.\r\n\r\n    @gkalpak said:\r\n    ATM `selector` and `nodeName`/`element-name` mean pretty much the same thing. But if we add support for \"customized built-in elements\", then `is` will be more accurate. Or maybe `name` or `definedName`, which is what [the spec calls it](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-name).\r\n\r\n    @IgorMinar said:\r\n    `name` would work for me.\r\n  \u003c/details>\r\n\r\n##\r\n- [ ] Remove the `NgElementConstructor#upgrade()` method.\r\n  \u003cdetails>\r\n    \u003csummary>Background / Previous discussion\u003c/summary>\r\n    This method can be used to upgrade any DOM element to an Angular Custom Element.\r\n    AFAICT, the initial reasoning was to be able to support environments that do not natively support Custom Elements. But using polyfills instead would result in a much better (and uniform) experience.\r\n\r\n    We could hide it from the public API, but keep the implementation in case it turns out to be useful.\r\n  \u003c/details>\r\n\r\n##\r\n- [ ] Support using a component in Angular templates _and_ exporting it as a custom element (in the same app).\r\n  The solution we had previously agreed on (for lack of a better alternative), was to prefix the selectors of Custom Elements. (So, if you define an Angular component with selector `foo-bar`, the Custom Element will be registered with selector `\u003cprefix>-foo-bar`.)\r\n  \u003cdetails>\r\n    \u003csummary>Background / Previous discussion\u003c/summary>\r\n    **Issue:**\r\n    ATM, when an Angular component is registered as a Custom Element, using it inside an Angular template causes it to be instantiated twice: Once by Angular’s compiler and once by the browser (which recognizes it as a Custom Element and calls its `connectedCallback()`). Essentially, there is no way to tell whether an element is part of an Angular view and therefore should not be treated as a custom element.\r\n\r\n    **Example:**\r\n    I want to publish my `\u003cfancy-button>` and `\u003cfancy-datepicker>` Angular components as Custom Elements (part of the same `NgModule`). `\u003cfancy-datepicker>` uses `\u003cfancy-button>` inside its template.\r\n\r\n    **Ideal solution:** _(currently not possible)_\r\n    Be able to detect from inside the `NgElementConstructor` (or at least the `connectedCallback()`) that something is inside an Angular view (e.g. in an Angular component’s template) and do nothing (i.e. not instantiate a component instance).\r\n\r\n    **Possible work-arounds:**\r\n    Use different selectors. E.g. `\u003cfancy-button>` inside Angular templates and `\u003cgk-fancy-button>` when used as a Custom Element.\r\n    - _Option 1_: We could add a new optional property to the `@Component` decorator (e.g. `customElementSelector: string`), which would default to the value of the `selector` property (useful when there is no intention to use the same component both as a Custom Element and inside Angular templates on the same page).\r\n    - _Option 2_: We could automatically prefix all selectors with a pre-defined (configurable) prefix when registering as custom elements (e.g. in `NgElements#register()`). So, `\u003cfancy-button>` would be (by default) registered as `'nge-fancy-button'` (where `nge` is a configurable prefix). This has the added benefit that essentially \"name-spaces\" the components and makes it easier to avoid conflicts between different Custom Element libraries. (Although, this might be a moot point, since it is already recommended to prefix your components with a custom prefix.)\r\n    - _Option 3_: Have an annotation which would tell the compiler that this element is CE. This way the renderer could create the element with a marker which would inhibit the CE facade from doing anything.\r\n\r\n    @mhevery said:\r\n    The only way I can think of doing this is for Renderer to put an expando on the DOM elements. That way when elements facade wakes up it can check for the presence of the expando and short circuit itself. The expando would have some cost on the DOM creation.\r\n    I think the easiest thing to do for now is to have a different prefix/suffix for the elements.\r\n\r\n    @gkalpak said:\r\n    Since the CE constructor is called before Angular instantiates the component, could we set a special property from the CE constructor that Angular could check and ignore the element?\r\n    (Will that be compatible with AoT?)\r\n\r\n    @mhevery said:\r\n    I don't think that is something that we could do since it would mean that ALL Angular apps would be penalized with the check regardless if they are using `@angular/elements`. I think our solution will have to be such that the onus is on `@angular/elements` to do the check. It's the CE which has to be suppressed rather than the Angular component.\r\n    So I think CE needs to be able to detect that Angular component is active and than become a noop. Not sure what is the best way to do that without penalizing everyone.\r\n    One idea is that we change the renderer to put an expand on all elements which have a dash. The issue is that checking if `-` dash is present and than monkey patching is not free, especially if you have to do the check for each element. So maybe the check would have to be done at compile time and then at runtime we would have to pass an extra info to the renderer. (Or maybe we don't have to change the compiler but change the view engine to do the check once per view).\r\n  \u003c/details>\r\n\r\n##\r\n- [ ] Remove the second signature of `registerAsCustomElements()`. \r\n  \u003cdetails>\r\n    \u003csummary>Background / Previous discussion\u003c/summary>\r\n    ATM, `registerAsCustomElements()` supports two signatures:\r\n\r\n    ```ts\r\n    function registerAsCustomElements(\r\n        customElementComponents: Type[],\r\n        bootstrapFn: () => Promise\u003cNgModuleRef>): Promise\u003cNgModuleRef>;\r\n    ```\r\n\r\n    ```ts\r\n    function registerAsCustomElements(\r\n        customElementComponents: Type[],\r\n        platformRef: PlatformRef,\r\n        moduleFactory: NgModuleFactory): Promise\u003cNgModuleRef>;\r\n    ```\r\n\r\n    The second is just a shorthand for:\r\n    \r\n    ```ts\r\n    registerAsCustomElements(\r\n        customElementComponents,\r\n        () => platformRef.bootstrapModuleFactory(moduleFactory))\r\n    ```\r\n\r\n    Unless there is any benefit to it (e.g. it is easier for the CLI to auto-rewrite for JiT/AoT, then I don't see any benefit in keeping both.\r\n\r\n  \u003c/details>\r\n","author":{"url":"https://github.com/gkalpak","@type":"Person","name":"gkalpak"},"datePublished":"2018-01-17T11:11:10Z","url":"https://github.com/angular/angular/issues/21585"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:4000b7b0-33f0-ed55-690d-5cd4d98530f3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDEB2:3F8AB1:1C426C8:23EF62B:6B013FDC
html-safe-nonce82467e5e2b277e8d3156f134891f16318757c07b1fdccf2be37671b4b4f9aa46
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERUIyOjNGOEFCMToxQzQyNkM4OjIzRUY2MkI6NkIwMTNGREMiLCJ2aXNpdG9yX2lkIjoiMTMwNzU5MDc4MjAzODkxNzA4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacfa4e14fa0054984c9ecc8b15bbbb95b9f5dc4bf363d0544a9ae5d6c3ba4df77a
hovercard-subject-tagissue:289227684
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/21585/issue_layout
twitter:imagehttps://opengraph.githubassets.com/abbfbd0bb8ed27172a433d0e8b5a44e623e1f2780f88874a6445d20bea255458/angular/angular/issues/21585
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/abbfbd0bb8ed27172a433d0e8b5a44e623e1f2780f88874a6445d20bea255458/angular/angular/issues/21585
og:image:altPossible @angular/elements public API (breaking) changes for discussion: Rename NgElementConstructor.is to NgElementConstructor.name. Background / Previous discussion Originally, we called this `se...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegkalpak
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/21585#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F21585
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F21585
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/21585
Reloadhttps://github.com/angular/angular/issues/21585
Reloadhttps://github.com/angular/angular/issues/21585
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues836 (836)https://github.com/angular/angular/issues
Pull requests141 (141)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/21585
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/21585
Discussion for possible @angular/elements public API changeshttps://github.com/angular/angular/issues/21585#top
area: elementsIssues related to Angular Elementshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20elements%22
needsTriagehttps://github.com/angular/angular/milestone/83
https://github.com/gkalpak
gkalpakhttps://github.com/gkalpak
on Jan 17, 2018https://github.com/angular/angular/issues/21585#issue-289227684
@robwormaldhttps://github.com/robwormald
@IgorMinarhttps://github.com/IgorMinar
@gkalpakhttps://github.com/gkalpak
the spec calls ithttps://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-name
@IgorMinarhttps://github.com/IgorMinar
@mheveryhttps://github.com/mhevery
@gkalpakhttps://github.com/gkalpak
@mheveryhttps://github.com/mhevery
gkalpakhttps://github.com/gkalpak
type: RFC / discussion / questionhttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22type%3A%20RFC%20%2F%20discussion%20%2F%20question%22
area: elementsIssues related to Angular Elementshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20elements%22
on Jan 17, 2018https://github.com/angular/angular/issues/21585#event-1428038978
https://github.com/robwormald
robwormaldhttps://github.com/robwormald
on Jan 19, 2018https://github.com/angular/angular/issues/21585#issuecomment-358823897
https://goo.gl/c8AVzShttps://goo.gl/c8AVzS
https://github.com/gkalpak
gkalpakhttps://github.com/gkalpak
on Jan 22, 2018https://github.com/angular/angular/issues/21585#issuecomment-359376151
ngbothttps://github.com/apps/ngbot
needsTriagehttps://github.com/angular/angular/milestone/83
on Feb 26, 2018https://github.com/angular/angular/issues/21585#event-1492231453
https://github.com/IgorMinar
IgorMinarhttps://github.com/IgorMinar
on Apr 10, 2018https://github.com/angular/angular/issues/21585#issuecomment-380265945
IgorMinarhttps://github.com/IgorMinar
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Apr 10, 2018https://github.com/angular/angular/issues/21585#event-1567304299
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Sep 13, 2019https://github.com/angular/angular/issues/21585#issuecomment-531224889
automatic conversation locking policyhttps://github.com/angular/angular/blob/67d80f/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Sep 13, 2019https://github.com/angular/angular/issues/21585#event-2632231405
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/21585
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/21585
area: elementsIssues related to Angular Elementshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20elements%22
needsTriageNo due datehttps://github.com/angular/angular/milestone/83
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.