You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
468 B
15 lines
468 B
1 year ago
|
import creator from "../creator";
|
||
|
import selector from "../selector";
|
||
|
|
||
|
function constantNull() {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
export default function(name, before) {
|
||
|
var create = typeof name === "function" ? name : creator(name),
|
||
|
select = before == null ? constantNull : typeof before === "function" ? before : selector(before);
|
||
|
return this.select(function() {
|
||
|
return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
|
||
|
});
|
||
|
}
|