Open xjamundx opened 11 years ago
I started with a custom elements approach via Mozilla's x-tag on https://github.com/brettz9/dialog .
It doesn't work with Chrome currently, apparently because Chrome won't allow registration without beginning with "x-" (but even when I tried with "x-", it still had some issues).
And there's no doubt more that could be done to support modal dialogs, etc. (and correct full-screen behavior). I didn't go through the entire relevant portion of the spec but hopefully of some use to at least start with a skeleton inspired by your work.
Btw, I changed the default styles to those recommended by the relevant portion of the spec and set them in JavaScript to avoid a CSS dependency. I may change things later to load the x-tags file dynamically or perhaps include it together, so there is also only one script to include. Thanks for the inspiration!
Btw, new Dialog is not part of a spec, right? Just for shimming?
Hey good work! I'm currently doing some native mobile development, so I haven't had much time to dive into this stuff, but it looks like yours is a good start.
Maybe you noticed then that I switched to Polymer/CustomElements to use a genuine polyfill without Mozilla's extra, non-standard, "x-tags" layer (I kept the x-tags branch); I prefer to keep the code as readable to standards-aware people as possible without too much wrapping. However, I'm not sure this was the best approach since the actual emerging standard for document.register
(soon to be document.registerElement
apparently) doesn't allow tags without 'x-' prefixed.
If necessary I'm sure I should be able to modify their code to use some other global or package our files together without adding a global, but that's a headache for maintainability. I could try seeing if they'd be ok accepting a non-standard flag to switch to a polyfill mode and avoid the native mechanism.
I guess as long as it does the job, I should probably focus on adding the missing features, but this was really only an interest toward utilizing what I felt should already be a well-established standard by now given its necessity, so not sure I'll even get to that.... Anyways, if something pushes me (or someone else) toward it again in the future, at least there is a skeleton for it.
Btw, although it is not part of the standard dialog element, the CustomElements standard that I used internally would allow for someone to follow your old API: var Dialog = document.register(...);
, again with the caveat that it be prefixed with "x-" like <x-dialog></x-dialog>
.
At the moment this sucks. Try using http://robdodson.me/blog/2013/03/19/custom-elements-intro/ or something else to make it suck less.