Comments (4)
I guess. If you use Maps in your code, you're pretty confident you have a modern browser or good polyfills, you could use Object.assign()
instead, merge loops only iterable properties and relies on clone for object like types or slice for arrays.
see https://github.com/mootools/mootools-core/blob/master/Source/Core/Core.js#L385-L412
as typeOf(new Map)
returns an object... then we also see Object.clone(new Map(...))
returns an empty object.
the correct way to clone a Map
is to return a new Map()
but if it needs to be recursive... then the following needs to happen:
- typeOf patched to detect
instanceof Map
/Set
(hard as it does not polyfill and in older browsers these are not going to be defined) - patch
Object.merge
to different clone; or/ and... - fix
Object.clone
to recursively work with maps/sets
It's not a hard fix but if this is fixed, then a bunch of other parts would have to be made aware of new types and features. Not sure who'd have the time and energy to do all that...
from mootools-core.
don't use -compat version. https://jsfiddle.net/970Lzu45/12/
from mootools-core.
The example returns an empty object instead of Map.
https://jsfiddle.net/970Lzu45/30/
Tested with latest version of Chrome 69.0.3497.100
from mootools-core.
Ended up not modifying Mootools and using an extra method to merge this type of data.
Beware if you use Maps in Mootools Class options. SetOptions use Object.merge()
Deep merge supporting Maps:
https://gist.github.com/zortext/7e37142a91c9abfcc641f6e2dc306235
Maps will not be merged and will be keeped as they are.
from mootools-core.
Related Issues (20)
- Update Array.prototype.flatten to match TC39 proposal HOT 13
- Deprecate MooTools? HOT 9
- creating 404 error for video preroll ad on adding just library. HOT 8
- Change this repo title to HTTPS HOT 7
- Conflict with ecmascript Map HOT 2
- Mootools + Google Maps V3 conflict issue causing google streetview not working. HOT 9
- MooTools library conflicting with new Event(typeArg) HOT 3
- NS_ERROR_FAILURE XMLHttpRequest exception HOT 9
- Mootools.net down HOT 8
- [spam]
- [SPAM]
- Mootools + Google adsense
- GHSL-2020-345: seeking security contact for your project
- Digital Marketing Course
- spam
- node modules error HOT 3
- mootools.net down HOT 2
- Joomla 3. Recaptcha v2 always spin. HOT 1
- Z
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 mootools-core.