7 lines
185 B
JavaScript
7 lines
185 B
JavaScript
|
var prev = function(node, selector) {
|
||
|
if (selector && document.querySelector(selector) !== node.previousElementSibling) {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
return node.previousElementSibling;
|
||
|
}
|