javascript中jQuery的.before()函数等效于什么? [英] What is the equivalent of jQuery's .before() function in Javascript?

查看:55
本文介绍了javascript中jQuery的.before()函数等效于什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Javascript中 .before()等效吗?

What is the equivalent of .before() in Javascript?

推荐答案

node.insertBefore()几乎等效:这是jQuery的作用: https://gist.github.com/kagagnon/a13de27760ba1af883c0#file-gistfile1-js-L6064

Here what jQuery does : https://gist.github.com/kagagnon/a13de27760ba1af883c0#file-gistfile1-js-L6064

before: function() {
    return this.domManip( arguments, function( elem ) {
        if ( this.parentNode ) {
            this.parentNode.insertBefore( elem, this );
        }
    });
}

这篇关于javascript中jQuery的.before()函数等效于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆