UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

30 lines (29 loc) 881 B
/** * DevExtreme (esm/integration/knockout/utils.js) * Version: 24.2.6 * Build date: Mon Mar 17 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import ko from "knockout"; import $ from "../../core/renderer"; export const getClosestNodeWithContext = node => { const context = ko.contextFor(node); if (!context && node.parentNode) { return getClosestNodeWithContext(node.parentNode) } return node }; export const getClosestNodeWithKoCreation = node => { const $el = $(node); const data = $el.data(); const hasFlag = data && data.dxKoCreation; if (hasFlag) { return node } if (node.parentNode) { return getClosestNodeWithKoCreation(node.parentNode) } return null };