javascript - Ext JS 中是否有其他方法,例如 jQuery .unwrap 方法?

标签 javascript jquery extjs

我找不到像使用 jQuery 那样打开元素的替代函数。 还有其他方法可以做到这一点吗?

我的目标是存档此代码并将其所有属性复制到其子元素。 并删除父级。

<div class="abc" myid="123" position="2">
<span class="someblock">
    <p>Some paragraph</p>
    <img width="140px; height: 140px;" class="myimg" src="http://www.urltoimage.com/image.png">
</span>
</div>

结果应该是:

<span class="someblock abc" myid="123" position="2">
<p>Some paragraph</p>
<img width="140px; height: 140px;" class="myimg" src="http://www.urltoimage.com/image.png" />
</span>

提前致谢,克里斯。

最佳答案

我总是使用 jQuery 发送我的 ExtJS 项目来执行此类操作,我建议您也这样做

它会让你的生活更轻松;)

编辑:

如果您严格需要在 ExtJS 中执行此操作,您将需要 Ext.dom.Element并对其进行操作。 Ext.get('id')将为您提供一个。

unwrap: function() {
    parent = this.parent().dom;
    this.insertBefore(parent );

    // code for copy the styles, classes & attributes here

    parent.destroy();
    return this;
}

The method is supposed to be called on Ext.dom.Element class or any one that extend it

关于javascript - Ext JS 中是否有其他方法,例如 jQuery .unwrap 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17210024/

相关文章:

javascript - 带有javascript原型(prototype)的ajax请求

javascript - 如何为 Web Worker 设置 Content-Security-Policy 以在 Edge/Safari 中工作?

javascript - 无法使用子选择器定位特定的 LI 元素

javascript - Bootstrap 模式与youtube视频在关闭时不会暂停

javascript - 无法关闭可关闭的选项卡和激活选项卡

javascript - 如何让 AngularJS 响应导航

javascript - 从本地驱动器加载图像

jquery - 为什么我无法在不破坏代码的情况下阻止动画队列堆叠?

javascript - 如何在应用程序中使用 Ext.list.Tree 组件?

gridview - extjs 有状态网格删除排序