MCPcopy
hub / github.com/tdewolff/minify / doCreateOrUpdateEl

Function doCreateOrUpdateEl

_benchmarks/sample_echarts.js:71627–71694  ·  view source on GitHub ↗
(api, el, dataIndex, elOption, seriesModel, group, isRoot, morphPreparation)

Source from the content-addressed store, hash-verified

71625 }
71626
71627 function doCreateOrUpdateEl(api, el, dataIndex, elOption, seriesModel, group, isRoot, morphPreparation) {
71628 if ("development" !== 'production') {
71629 assert(elOption, 'should not have an null/undefined element setting');
71630 }
71631
71632 var toBeReplacedIdx = -1;
71633
71634 if (el && doesElNeedRecreate(el, elOption) // || (
71635 // // PENDING: even in one-to-one mapping case, if el is marked as morph,
71636 // // do not sure whether the el will be mapped to another el with different
71637 // // hierarchy in Group tree. So always recreate el rather than reuse the el.
71638 // morphPreparation && morphPreparation.isOneToOneFrom(el)
71639 // )
71640 ) {
71641 // Should keep at the original index, otherwise "merge by index" will be incorrect.
71642 toBeReplacedIdx = group.childrenRef().indexOf(el);
71643 el = null;
71644 }
71645
71646 var elIsNewCreated = !el;
71647
71648 if (!el) {
71649 el = createEl(elOption);
71650 } else {
71651 // FIMXE:NEXT unified clearState?
71652 // If in some case the performance issue arised, consider
71653 // do not clearState but update cached normal state directly.
71654 el.clearStates();
71655 }
71656
71657 var canMorph = inner$9(el).canMorph = elOption.morph && isPath$1(el);
71658 var thisElIsMorphTo = canMorph && morphPreparation && morphPreparation.hasFrom(); // Use update animation when morph is enabled.
71659
71660 var isInit = elIsNewCreated && !thisElIsMorphTo;
71661 attachedTxInfoTmp.normal.cfg = attachedTxInfoTmp.normal.conOpt = attachedTxInfoTmp.emphasis.cfg = attachedTxInfoTmp.emphasis.conOpt = attachedTxInfoTmp.blur.cfg = attachedTxInfoTmp.blur.conOpt = attachedTxInfoTmp.select.cfg = attachedTxInfoTmp.select.conOpt = null;
71662 attachedTxInfoTmp.isLegacy = false;
71663 doCreateOrUpdateAttachedTx(el, dataIndex, elOption, seriesModel, isInit, attachedTxInfoTmp);
71664 doCreateOrUpdateClipPath(el, dataIndex, elOption, seriesModel, isInit);
71665 var pendingAllPropsFinal = updateElNormal(api, el, thisElIsMorphTo, dataIndex, elOption, elOption.style, attachedTxInfoTmp, seriesModel, isInit, false);
71666
71667 if (thisElIsMorphTo) {
71668 morphPreparation.addTo(el, elOption, dataIndex, pendingAllPropsFinal);
71669 }
71670
71671 for (var i = 0; i < STATES.length; i++) {
71672 var stateName = STATES[i];
71673
71674 if (stateName !== NORMAL) {
71675 var otherStateOpt = retrieveStateOption(elOption, stateName);
71676 var otherStyleOpt = retrieveStyleOptionOnState(elOption, otherStateOpt, stateName);
71677 updateElOnState(stateName, el, otherStateOpt, otherStyleOpt, attachedTxInfoTmp);
71678 }
71679 }
71680
71681 updateZ$1(el, elOption, seriesModel);
71682
71683 if (elOption.type === 'group') {
71684 mergeChildren(api, el, dataIndex, elOption, seriesModel, morphPreparation);

Callers 3

createOrUpdateItemFunction · 0.85
mergeChildrenFunction · 0.85
processAddUpdateFunction · 0.85

Calls 12

doesElNeedRecreateFunction · 0.85
createElFunction · 0.85
isPath$1Function · 0.85
doCreateOrUpdateClipPathFunction · 0.85
updateElNormalFunction · 0.85
retrieveStateOptionFunction · 0.85
updateElOnStateFunction · 0.85
updateZ$1Function · 0.85
assertFunction · 0.70
mergeChildrenFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…