User tests: Successful: Unsuccessful:
Some resources:
[W3C] : https://www.w3.org/TR/custom-elements/
[MDN] : https://developer.mozilla.org/en-US/docs/Web/Web_Components/Custom_Elements
[Google] : https://developers.google.com/web/fundamentals/getting-started/primers/customelements
Custom element is a W3C standard that is backed by all the major browsers. At the time of writing this only Chrome and Opera support them without a polyfill, but next version of Safari and Firefox will, Microsoft will follow later this year.
win-win-win-win!
This can coexist with the original bootstrap markup and javascript so there is no B/C break in any way.
We are introducing a new API and also a new markup, so documentation is vital!
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Templates (admin) Layout JavaScript |
Maybe it's me not understanding custom elements yet or me not don't sharing the "We should not use Bootstrap" mentality, but I don't see the point in this example. Maybe it's also just a bad example.
Imho it makes my life as a developer (both template and extension) only harder, not easier.
We are introducing a new API and also a new markup, so documentation is vital!
Since we are known to be very good at documenting our stuff, that will be the main point where this would either succeed or fail. Being realist it will be the latter.
It looks like we're going to cook our own soup here again instead of using some (very well documented!) "standard". I really don't like the NIH syndrome
From what I understand about custom elements, they make a lot of sense when you want to include custom functionality (eg a dropdown list that changes behavior based on content or expands the adds features to it). But for regular markup stuff it doesn't make much sense to me. For that we can use JLayouts just fine.
@Bakual Alerts are not just some random markup, there is a script that comes with it (for the close function, it has a method and 2 events)
Documentation should be easy since there are plenty of tools out there for this, e.g. https://github.com/QingWei-Li/docsify
To make this example more interesting in your browser's console type:
tmp = document.querySelector('bs4-alert');
tmp.close();
OK So I think custom elements are going to take off over the next 5 years so I'm not against this. However caveats:
Quick answers:
joomla-jui-{element}
but this is totally configurable on the build script, so no worries. About the overriding mechanism: is the same as css and js basically we need an JHtml::_('customElements', $path, $options)
I hope this makes some sense
I really like the approach and it will make the life for me as extension developer much easier, as I don't have to care about frontend framework vendor specific markup anymore. It is the best approach I'v seen so far to become frontend framework independent.
I would also recommend not to have have bs4 in the elements names. But sounds like you are going to change that.
What for me is unclear how it would work then for a Foundation based template to load the foundation alert custom element. Would it be then trough JHTML overrides or will it be simpler with some kind of auto detection?
@laoneo the call for an alert (server side/php) will be JHtml::_('customElements', $path, $options)
both for bootstrap or foundation or any other css framework. For client side is just like creating a usual element:
var tempElement = document.createElement('bs4-alert');
tempElement.setAttribute('data-type', 'success');
tempElement.setAttribute('data-button', 'true');
tempElement.innerHTML = 'Wow it works!';
document.body.appendChild(tempElement);
Try to do the same (especially client side) with bootstrap...
So when I want to provide my own fundation custom elements, then I need to reigster my own customElements script in JHtml?
Maybe it's me not understanding custom elements yet or me not don't sharing the "We should not use Bootstrap" mentality, but I don't see the point in this example. Maybe it's also just a bad example.
Imho it makes my life as a developer (both template and extension) only harder, not easier.
This doesn't in any way remove support for Bootstrap alerts....you, template devs and extension devs are quite within you right to continue using BS/jQuery if you want to.
At the end of the day, this means that Joomla supports a web component that isn't couple to BS4....which IS a big factor for extension and template devs. Once template devs realise that we're utilising web components, they can support them, and thus alerts will then work on ANY frontend framework being used.
We all have our own extensions, we all know how bloody annoying it is whgen trying to cater for other frameworks. As it stands, on one of my own modules, I've had to resort to adding a backend parameter to select the framework you wish to use (BS2, BS3, UIKit).
Ignore the fact that this PR is loading something from a CDN....Dimitris he stated it's purely for demonstration purposes
Oh and what do you know? Even Google have re-built G-Earth with Web Components: https://earth.google.com/web
I will redo this one later on..
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-05-24 21:02:36 |
Closed_By | ⇒ | dgt41 | |
Labels |
Added:
?
|
RFC issues and PRs are perfectly valid.