It's a reasonably safe bet that Web Components APIs will become part of the lingua franca of the web in the near future, and JavaScript frameworks will either support them or die. Standardization is still a ways off for some of the APIs, and due to various technical reasons most of the current polyfills cannot truly emulate the APIs reliably and completely across modern browsers, most notably, Shadow DOM.
However, after reading TJ VanToll's blog post, it got me thinking about what can be done now in production ready, cross-browser code to help future proof components and apps. It seems that Custom Elements can be polyfilled across all the latest browsers with two caveats. The :unresolved pseudo element can't be used yet, and some of the method and callback names (not logic) may still change before standardization. Both of these issues are minor and definitely not show stoppers.
Now it's not really debatable that Shadow DOM is the magical browser capability that UI component developers crave for encapsulation, especially for component CSS. But Custom Elements provide more value than might be apparent on the surface. After all we can make up element names now and the browser won't complain, right?
Besides allowing new elements to become official citizens of the DOM rather than illegal aliens, Custom Elements allow us component developers to define the APIs that allow components to be export, imported, shared, and re-used within frameworks and across frameworks. This is because APIs are plain old HTML element APIs- attributes, properties, methods, and events.
Lately I've been playing with W3C Custom Element generation from within AngularJS 1.x code. When AngularJS 2.0 arrives, it will be integrated with Web Components APIs. It will be able to import and export Custom Elements, and will have specialized directives including template and component directives to do this rather than the generic directive definitions we have now in 1.x.
Below is a GitHub Gist I posted of an AngularJS service that acts as a generic Custom Element factory, and what I would define as an AngularJS 1.x component directive that accesses it. It works in Chrome and Opera without a polyfill, and the rest with a custom-element-only polyfill like https://github.com/WebReflection/document-register-element.
This is the first version, and I have yet to play with it using existing AngularJS components, but I plan to do so extensively. One of the big questions about creating custom element from inside a framework is where the framework should end and the DOM APIs begin. In other words, should we now be thinking about placing most or all of the component's logic in it's DOM properties and methods, or will much of the logic still remain in the framework part of the "framework enhanced" component (i.e. $scope)? Storing logic and data in the DOM makes custom element components independent of any framework, and therefore portable and sharable. But then we have everyone accessing the global context!
Thank you for sharing your thoughts and knowledge on this topic.
ReplyDeleteAngular JS Online training
Angular JS training in hyderabad
I perceived a lots of new Technical things in this wonderful site.Unique information's are shared through it.Keep working Like this
ReplyDeleteJava training in chennai | Java training in annanagar | Java training in omr | Java training in porur | Java training in tambaram | Java training in velachery
Really it was an awesome blog...Nice article I was really impressed by seeing this blog, it was very interesting and it is very useful for me.
ReplyDeleteSalesforce Training in Chennai
Salesforce Online Training in Chennai
Salesforce Training in Bangalore
Salesforce Training in Hyderabad
Salesforce training in ameerpet
Salesforce Training in Pune
Salesforce Online Training
Salesforce Training
Its really helpful for the users of this site. I am also searching about these type of sites now a days. So your site really helps me for searching the new and great stuff.
ReplyDeleteJava Training in Chennai
Java Training in Velachery
Java Training in Tambaram
Java Training in Porur
Java Training in OMR
Java Training in Annanagar
Thank you for sharing this useful article with us. This blog is a very helpful to me in future. Keep sharing informative articles with us.
ReplyDeletehttps://www.ahmedabadcomputereducation.com/course/laravel-training-course/
Awesome content for reading as well as knowledge. Thank you for sharing this informative article with us.
ReplyDeletehttps://www.sdsfin.in/about-us/
Thank You for sharing this informative article.
ReplyDeletehttps://web30india.com/
Android Mobile App Development in Ahmedabad
ReplyDeleteWeb 3.0 India is the most trusted Web3 Blockchain Development and NFT Development Company in USA. We also provides ICO, STO development for cryptocurrency.
https://web30india.com/
I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it.
ReplyDeleteBSc Time Table - B.SC 1 2 3 Ka Exam Date Scheme 2022
BSc 1st Year Time Table 2022
BSc 2nd Year Time Table 2022
BSc 3rd Year Time Table 2022
제주도콜걸
ReplyDelete계룡콜걸
제주시콜걸
제주도콜걸
제주도콜걸
총판출장샵
총판출장샵
총판출장샵
고고출장샵
심심출장샵