Comments (9)
Could we define a d-mixin custom element to do the behavior mixin, rather than custom parsing of data attribute, eg.
<d-treemap data-mixins="">
<d-mixin>dtreemap/Keyboard</d-mixin>
</d-treemap>
from delite.
I'm not sure why we would do that. It seems more complicated.
from delite.
The alternative is to ask users to redefine their own tag:
register("my-treemap", [TreeMap, Keyboard]);
and then use it:
<my-treemap></my-treemap>
I think this is very linked to #27. If we don't get auto-loading, then honesty this is probably not dramatic to ask people to do this as they will anyway have to manually import the TreeMap module. But if we keep the idea of being able to simply write markup and not have to deal with JavaScript to import/instantiate modules then having to fallback to JavaScript for the mixins won't fit the strategy.
In other words, if we don't implement #27 and close it I think this makes sense to be "consistent" and close also this one. If we implement #27 then I think we should do something for that one as well so that the pure markup solution is complete.
from delite.
register("my-treemap", [TreeMap, Keyboard]);
won't work, apparently it needs to be:
register("my-treemap", [HTMLElement, TreeMap, Keyboard]);
despite TreeMap is already and HTMLElement.
Maybe we should have a helper function?
TreeMap.createSubWidget("my-treemap", [Keyboard]);
It should both include HTMLElement automatically and do the registration?
like we had in Dojo 1.X? Under that conditions it might be easier to accept the lack of data-dojo-mixins?
from delite.
register("my-treemap", [TreeMap, Keyboard]);
is supposed to work. I guess there's a bug; I'll look into it.
from delite.
Maybe there is something specific to the TreeMap that breaks this. Basically the widget is created but at runtime things like properties expected to be here are not and things like that.
from delite.
For the record, I talked privately to @cjolif and he couldn't reproduce the problem with
register("my-treemap", [TreeMap, Keyboard]);
I did add some unit tests (in register.js) to make sure that sort of thing works.
from delite.
For browsers that have native custom element support, you associate a prototype with a custom tag. I don't think it's practical or prudent to switch-out that prototype with a custom class we define on the fly.
So, if we did support data-mixin
, the "classes" that we mix in would need to be lightweight objects. Perhaps a mixin would just be a function that would setting up advice on the main classes pre-existing methods.
from delite.
if we did support data-mixin, the "classes" that we mix in would need to be lightweight objects. Perhaps a mixin would just be a function that would setting up advice on the main classes pre-existing methods.
Realistically I don't see us doing that (although it would be an interesting experiment). Thus I'm closing this ticket and also #27 for now.
from delite.
Related Issues (20)
- Don't set blank attribute values
- HasDropDown: SPACE key doesn't open dropdown when JAWS is running
- HasDropDown: add flag for popup type
- Upgrade to DCL V2 HOT 7
- HasDropDown: DOM node leak, old popups not always destroyed.
- FormWidget: caret can jump to end of text while typing
- delite/popup: automatically detect popup size change
- Centered popups disappear on resize in RTL mode
- Viewport: replace polling HOT 1
- element resize observer HOT 4
- delite/popup: replace polling
- Fix iOS focus problems when dialog input element is clicked
- Close dropdown when anchor node scrolled out of view
- delite not working in Safari 12.1 HOT 2
- delite/popup: support scrub gesture to close popup HOT 1
- JAWS browse mode broken in dropdown dialogs
- KeyNav: let handler choose to not handle key
- Shift-tabbing into KeyNav container from browser address bar broken
- ES6 module format conversion
- lit-html preparation and conversion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delite.